CFileDialog & GetOpenFileName
-
Hello, I am still stuck on something I posted a question about a couple of weeks ago (I thought I figured it out but that isn't the case). I am using VC++ 2003 .NET. I believe that I did install the Windows 2003 Server SDK but I am not sure how I can tell, I don't see it listed in add-remove programs nor under updates. Anyway, I have tried to use both CFileDialog and GetOpenFileName and both cause a First-chance exception. The exception doesn't happen the first time the file dialog is displayed but it will always happen the 2nd time its displayed. The error is listed below. I have done tons of research on the net and it appears that a lot of other people are having the same problem but I havent seen any resolutions that actually work (most suggest its a problem caused by the Windows 2003 Server SDK).
Heres the error:
First-chance exception at 0x7ca51406 in SiteConsole.exe:
0xC0000005:
Access violation reading location 0x016d4980.Debugging hasn't lead me anywhere...
Heres the code: it's pretty straight forward.
void CExcludeDlg::OnBnClickedBImport()
{
UpdateData(TRUE);/* I can use either GetOpenFileName or CFileDialog and both cause the exception.
OPENFILENAME ofn;
TCHAR pszFile[MAX_PATH*2];\_tcscpy(pszFile, \_T("") ); memset(&ofn, 0, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); // I think this is the problem because of the SDK ofn.hwndOwner = GetSafeHwnd(); ofn.lpstrFile = pszFile; ofn.nMaxFile = sizeof(pszFile); ofn.Flags = OFN\_FILEMUSTEXIST | OFN\_HIDEREADONLY | OFN\_NONETWORKBUTTON | OFN\_FILEMUSTEXIST; ofn.lpstrFilter = \_T("All Files (\*.\*)\\0\*.\*\\0Executables (\*.exe;\*.ocx;\*.dll)\\0\*.exe;\*.ocx;\*.dll\\0"); ofn.lpstrTitle = \_T("Please select a file"); if (GetOpenFileName( &ofn )) { // I don't have to do anything it will still crash. }
*/
static char BASED_CODE szFilter[] = _T("Text File (*.txt)|*.txt||");
CFileDialog m_ldFile(TRUE, _T(".txt"), NULL, OFN_HIDEREADONLY, szFilter);
if (m_ldFile.DoModal() == IDOK)
{
// I don't have to do anything it will still crash.
}UpdateData(FALSE);
}
On a side note how can I uninstall windows 2003 server SDK? This may fix the problem. Thanks! Rob Whoever said nothing's impossible never tried slamming a revolving door!
-
Hello, I am still stuck on something I posted a question about a couple of weeks ago (I thought I figured it out but that isn't the case). I am using VC++ 2003 .NET. I believe that I did install the Windows 2003 Server SDK but I am not sure how I can tell, I don't see it listed in add-remove programs nor under updates. Anyway, I have tried to use both CFileDialog and GetOpenFileName and both cause a First-chance exception. The exception doesn't happen the first time the file dialog is displayed but it will always happen the 2nd time its displayed. The error is listed below. I have done tons of research on the net and it appears that a lot of other people are having the same problem but I havent seen any resolutions that actually work (most suggest its a problem caused by the Windows 2003 Server SDK).
Heres the error:
First-chance exception at 0x7ca51406 in SiteConsole.exe:
0xC0000005:
Access violation reading location 0x016d4980.Debugging hasn't lead me anywhere...
Heres the code: it's pretty straight forward.
void CExcludeDlg::OnBnClickedBImport()
{
UpdateData(TRUE);/* I can use either GetOpenFileName or CFileDialog and both cause the exception.
OPENFILENAME ofn;
TCHAR pszFile[MAX_PATH*2];\_tcscpy(pszFile, \_T("") ); memset(&ofn, 0, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); // I think this is the problem because of the SDK ofn.hwndOwner = GetSafeHwnd(); ofn.lpstrFile = pszFile; ofn.nMaxFile = sizeof(pszFile); ofn.Flags = OFN\_FILEMUSTEXIST | OFN\_HIDEREADONLY | OFN\_NONETWORKBUTTON | OFN\_FILEMUSTEXIST; ofn.lpstrFilter = \_T("All Files (\*.\*)\\0\*.\*\\0Executables (\*.exe;\*.ocx;\*.dll)\\0\*.exe;\*.ocx;\*.dll\\0"); ofn.lpstrTitle = \_T("Please select a file"); if (GetOpenFileName( &ofn )) { // I don't have to do anything it will still crash. }
*/
static char BASED_CODE szFilter[] = _T("Text File (*.txt)|*.txt||");
CFileDialog m_ldFile(TRUE, _T(".txt"), NULL, OFN_HIDEREADONLY, szFilter);
if (m_ldFile.DoModal() == IDOK)
{
// I don't have to do anything it will still crash.
}UpdateData(FALSE);
}
On a side note how can I uninstall windows 2003 server SDK? This may fix the problem. Thanks! Rob Whoever said nothing's impossible never tried slamming a revolving door!
Does this happen on all machines or just one in particular? Does it happen if you statically link with the MFC libraries?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
-
Does this happen on all machines or just one in particular? Does it happen if you statically link with the MFC libraries?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
This is an administration application and we only run it on 2 workstations both are Windows XP and it's failing on both. In debug mode I see the exception but in release mode it just closes the application with out any errors. My application is currently statically linked with MFC. I did just find this on the MSDN forums http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=154126&SiteID=1 They claim this problem was fixed with version 7.1 but I am running v7.1.3088 and I still have the issue... I went into afxdlgs.h and OPENFILENAME is currently defined as __declspec(property(get=GetOFN)) OPENFILENAME m_ofn; Strange. [Had to edit the URL] Whoever said nothing's impossible never tried slamming a revolving door! -- modified at 12:30 Wednesday 26th April, 2006
-
Does this happen on all machines or just one in particular? Does it happen if you statically link with the MFC libraries?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
-
Does this happen on all machines or just one in particular? Does it happen if you statically link with the MFC libraries?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
-
Does this happen on all machines or just one in particular? Does it happen if you statically link with the MFC libraries?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
Finally I found out what is causing the issue!! Now to try to figure out a work around... After tons of searching on the net people were saying there is a shell bug with Adobe Reader 7.0 and to uninstall it to see if the bug goes away and IT DID! Now is there a way to force the application to not load the acrobat dll? In the debugger I would see the CFileDialog load pdfshell.dll and then unload, on the second load if I do a mouse over to display the tool tip it would crash my app. Whoever said nothing's impossible never tried slamming a revolving door! -- modified at 14:34 Wednesday 26th April, 2006
-
Finally I found out what is causing the issue!! Now to try to figure out a work around... After tons of searching on the net people were saying there is a shell bug with Adobe Reader 7.0 and to uninstall it to see if the bug goes away and IT DID! Now is there a way to force the application to not load the acrobat dll? In the debugger I would see the CFileDialog load pdfshell.dll and then unload, on the second load if I do a mouse over to display the tool tip it would crash my app. Whoever said nothing's impossible never tried slamming a revolving door! -- modified at 14:34 Wednesday 26th April, 2006
By chance have you posted your question to the microsoft.public.vc.mfc newsgroup?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
-
Finally I found out what is causing the issue!! Now to try to figure out a work around... After tons of searching on the net people were saying there is a shell bug with Adobe Reader 7.0 and to uninstall it to see if the bug goes away and IT DID! Now is there a way to force the application to not load the acrobat dll? In the debugger I would see the CFileDialog load pdfshell.dll and then unload, on the second load if I do a mouse over to display the tool tip it would crash my app. Whoever said nothing's impossible never tried slamming a revolving door! -- modified at 14:34 Wednesday 26th April, 2006
See if this helps.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
-
See if this helps.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
Yeah I found that one the other day too... Didn't make any difference... Microsoft has a patch but you have to call their support line to request it. I'm going to have work call and get the patch I think they have a support contract. Thanks again for helping! Rob Whoever said nothing's impossible never tried slamming a revolving door!
-
See if this helps.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb