int CGenethonDoc::GetPhylipFile( CString PathName, int Append ) { CPtrList CommentList; CPtrList SequenceList; if ( !ReadPhylipIFile( &CommentList, &SequenceList, PathName ) ) { while ( !CommentList.IsEmpty() ) { delete (CString *)CommentList.RemoveHead(); } while ( !SequenceList.IsEmpty() ) { delete (SeqNameStruct *)SequenceList.RemoveHead(); } return 0; } SeqNameStruct *tSNS = (SeqNameStruct *)SequenceList.GetHead(); gMaxStrSize = tSNS->Len; return ProcessRows( CommentList, SequenceList, Append ); }
void CDlgTimedMessageBox::GetWindowHandles(void) { HWND hWnd; CWnd *pWnd; CString title; CPtrList allButtons; // // Handle of the messageBox // if( !m_hMsgBox ) { hWnd = ::GetWindow(::GetDesktopWindow(), GW_CHILD); while( (hWnd!=NULL) && (m_hMsgBox==NULL) ) { pWnd = CWnd::FromHandle(hWnd); pWnd->GetWindowText(title); if( ::AfxIsDescendant(m_hParent, hWnd) && ::IsWindowVisible(hWnd) && (m_Title.CompareNoCase(title)==0) ) { m_hMsgBox = hWnd; break; } hWnd = ::GetWindow(hWnd, GW_HWNDNEXT); } } // // Handle of the static text // TODO only if text-replace is needed // if( m_hMsgBox && !m_hStaticText ) { // not sure if this will work always // under Win2000 it did //m_hStaticText = ::GetDlgItem(m_hMsgBox, 0xFFFF); // not sure, so lets find it dynamically! char className[_MAX_PATH]; CString classNameOk("STATIC"); LONG id; hWnd = ::GetWindow(m_hMsgBox, GW_CHILD); while( (hWnd!=NULL) && (m_hStaticText==NULL) ) { id = ::GetWindowLong(hWnd, GWL_ID); // small ids only for buttons if( id > IDHELP ) { if( ::GetClassName(hWnd, className, _MAX_PATH) ) { // looking only for a static if( classNameOk.CompareNoCase(className) == 0 ) { // not check the text pWnd = CWnd::FromHandle(hWnd); pWnd->GetWindowText(title); if( m_CurrentMessage.CompareNoCase(title) == 0 ) { m_hStaticText = hWnd; break; } } } } else { allButtons.AddTail(hWnd); } hWnd = ::GetWindow(hWnd, GW_HWNDNEXT); } } // // Handle of the default button // if( m_hMsgBox && !m_hDefaultButton ) { m_hDefaultButton = ::GetDlgItem(m_hMsgBox, m_DefaultReturn); // Problem: (reported from Keith Brown) // if generated with MB_OK the button has NOT IDOK, but IDCANCEL !! // then lets take the first button we find ! // (with and IDCANCEL this works, because it is the only button // if this problem encounters also with 2 buttons, I have no chance // to find out which one is the better one!) while( allButtons.GetCount()>0 && !m_hDefaultButton ) { m_hDefaultButton = (HWND) allButtons.GetHead(); allButtons.RemoveHead(); if( m_hDefaultButton ) m_DefaultReturn = ::GetWindowLong(m_hDefaultButton, GWL_ID); } } }