Re: CFileDialog crash on Vista
"jochen.stier" <jochen.stier-/[email protected]>
| Newsgroups | gmane.comp.windows.wtl |
|---|---|
| Message-ID | <[email protected]> |
I have tried changing to _WTL_NO_CSTRING but the problem still occurs. I did install VC 2005 on my vista machine and recompiled the app there, but the problem still occurred. The good thing is that I could step through the code with the debugger to the point where it crashed. It happens in the DoModal call of the CFileDialog at the following line: bRet = ::GetOpenFileName(&m_ofn); I have been reading that Vista handles the FileDialogs differently than XP did and there are various references to GetOpenFileName, but I cannot figure out what I should do here. Jochen --- In [email protected], "domehead100" <domehead100@...> wrote: > > --- In [email protected], "jochen.stier" <jochen.stier@> wrote: > > > > Hi, > > > > > > > > I am having the oddest problem with wtl8 on Vista. Opening a file dialog brings up a wait cursor and then my App hangs; no window appears. Of course this runs fine under XP. > > > > CFileDialog lDialog(TRUE); > > > > lDialog.doModel(); > > > > I am using Visual Studio 2005 and I have recently upgraded to wtl8 after I had the same problem with wtl71. I have been googling the problem and it turns out that the CFileDialog are handled differently under Vista, but I could not really find a solution to the problem. Does anyone have a hunch what could cause this problem? Do I need some special entry in stdafx.h or use a particular compiler flag? This is what my stdafx.h looks like > > > > > > #define WINVER 0x0400 > > #define _WIN32_WINNT 0x0500 > > #define _WIN32_IE 0x0501 > > > > #define _WTL_USE_CSTRING > > #define _ATL_APARTMENT_THREADED > > > > #include <atlbase.h> > > #include <atlapp.h> > > > > extern CAppModule _Module; > > > > #include <atlcom.h> > > #include <atlhost.h> > > #include <atlwin.h> > > #include <atlctl.h> > > > > > > > > Cheers > > > > Just a guess, not much info to go on, but it's good practice to use ATL::CString instead of WTL::CString. > > So, change: > #define _WTL_USE_CSTRING > to > #define _WTL_NO_CSTRING > #include <atlstr.h> > > (I think that _WTL_NO_CSTRING is only needed if you are including atlmisc.h, not 100% sure without checking) > > ~Mike > ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/wtl/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/wtl/join (Yahoo! ID required) <*> To change settings via email: mailto:[email protected] mailto:[email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/