WIndows Sucks...GetOpenFileName COInitializeEx(COINIT_MULTITHREADED)
-
open dilaog after 15 years does not work propertly. Do a simple app. Make it enter MTA. Pop up a Common Open/Save File Dialog. On Win2K Hangs When Selecting topmost My Documents Folder. On Win XP, By selecting my computer the list view is empty. On both OS-es sometime list of files is chopped (if does not hang meanwhile). I would apreciate any workaround. But after 15 years they could not get it right a ... so common open dialog...
-
open dilaog after 15 years does not work propertly. Do a simple app. Make it enter MTA. Pop up a Common Open/Save File Dialog. On Win2K Hangs When Selecting topmost My Documents Folder. On Win XP, By selecting my computer the list view is empty. On both OS-es sometime list of files is chopped (if does not hang meanwhile). I would apreciate any workaround. But after 15 years they could not get it right a ... so common open dialog...
around.: [code] class COd : public CFileDialog { public: COd(BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL):CFileDialog(bOpenFileDialog, lpszDefExt , lpszFileName , dwFlags , lpszFilter , 0 ) { } int DoModal(){ return CFileDialog::DoModal(); } BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) { BOOL ret = CFileDialog::OnNotify(wParam, lParam, pResult); OFNOTIFY* pNotify = (OFNOTIFY*)lParam; switch(pNotify->hdr.code) { case CDN_TYPECHANGE: { CWnd* pWnd = GetActiveWindow(); CWnd* PDlg = pWnd; if(pWnd) { GetFocus()->PostMessage(WM_KEYDOWN,VK_RETURN,0); GetFocus()->PostMessage(WM_KEYUP,VK_RETURN,0); } } break; } return ret; } virtual void OnFolderChange() { TCHAR cs[128]; CWnd* pWnd = GetActiveWindow(); CWnd* PDlg = pWnd; CWnd* PSlv = 0; int relation = GW_CHILD|GW_HWNDFIRST; while(pWnd = pWnd->GetWindow(relation)) { GetClassName(pWnd->m_hWnd, cs,128); if(!strcmp("SHELLDLL_DefView",cs)) { CWnd* pSave = pWnd; int relation = GW_CHILD|GW_HWNDFIRST; while(pWnd = pWnd->GetWindow(relation)) { GetClassName(pWnd->m_hWnd, cs,128); if(!strcmp("SysListView32",cs)) { PSlv = pWnd; break; } relation = GW_HWNDNEXT; } pWnd = pSave; } relation = GW_HWNDNEXT; } } }; class DlgWrap { public: DlgWrap(BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEP