From: uggas on 23 Jun 2008 13:54 Hi, We ran into this problem when trying to move to Visual Studio 2008 from Visual Studio 2005. We have a custom class derived from CFileDialog to handle OnTypeChange() and in that call we try to set the file name directly by calling SetControlText() as below: void MyFileSaveDlg::OnTypeChange() { . . SetControlText(edt1, fileName); . . } The SetControlText() call causes crash when application is built with Visual Studio 2008 is run on Vista. Although the documentation for new version of CFileDialog states that the Control ID system is different in Vista but it doesn't point where should one look to update the references. In stdafx.h we have defined our WINVER to be 0x501. My question is how can we fix that so that our application can run on XP and Vista but built with Visual Studio 2008. Thanks.
From: Ganga Sridhar on 27 Jun 2008 10:39 Have the constructor of your CMyFileSaveDlg class to check the version of OS installed and st the size for the OPENFILENAME structure accordingly. DWORD dwSize = 0; OSVERSIONINFO vi; ZeroMemory(&vi, sizeof(OSVERSIONINFO)); vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); ::GetVersionEx(&vi); if (vi.dwMajorVersion >= 5) { dwSize = sizeof(OPENFILENAME); } else { dwSize = OPENFILENAME_SIZE_VERSION_400; } m_ofn.lStructSize = dwSize; "uggas" <uggas(a)discussions.microsoft.com> wrote in message news:7DF57872-FAF7-49D2-A45F-B018E555CE13(a)microsoft.com... > Hi, > We ran into this problem when trying to move to Visual Studio 2008 from > Visual Studio 2005. We have a custom class derived from CFileDialog to > handle > OnTypeChange() and in that call we try to set the file name directly by > calling SetControlText() as below: > > void MyFileSaveDlg::OnTypeChange() > { > . > . > SetControlText(edt1, fileName); > . > . > } > > The SetControlText() call causes crash when application is built with > Visual > Studio 2008 is run on Vista. Although the documentation for new version of > CFileDialog states that the Control ID system is different in Vista but it > doesn't point where should one look to update the references. In stdafx.h > we > have defined our WINVER to be 0x501. > > My question is how can we fix that so that our application can run on XP > and > Vista but built with Visual Studio 2008. > > Thanks.
From: uggas on 7 Jul 2008 13:20 Thanks for your reply Ganga. I tried your suggestion but it still crashes on SetControlText(edt1, fileName); Thanks Uggas
|
Pages: 1 Prev: Unable to link (static MFC) Next: Get MFCGridCtrl's Cell Text via sendmessage API? |