Question about CFileDialog class
-
When you come to Domodal set a breakpoint after it
WhiteSky
-
What does the call stack look like? Is there any line that points to code for which you have source code? I assume you have built your application for debug...:~ -- Rog
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998
"...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above -
...it dies during CFileDialog::DoModal() method (i mean, it dies while my dialog waits for CFileDialog::DoModal() to return)
7CA5159E call dword ptr [ecx+14h]
That's the disassembly code, but i don't know what to do with it, i don't think it helps
Did you try displaying a message box before and after your CFileDialog creation? What happens in that case?
Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா
-
I have a dialog with two browse buttons on it. If i press the frist one, select a file than press the seccond one, my application crashes and i can't figure out why :( . Here's the code:
//first browse button
void CAddEquipDlg::OnBnClickedBrowsedb()
{
char szFilters[]=
"Access DB (*.mdb)|*.mdb|All Files (*.*)|*.*||";CFileDialog fDlg(TRUE, "mdb", "\*.mdb", OFN\_FILEMUSTEXIST| OFN\_HIDEREADONLY, szFilters, NULL ); if (fDlg.DoModal()==IDOK) { m\_sDB = fDlg.GetPathName(); } SetCurrentDirectory(m\_sCurDir); SetDlgItemText(IDC\_DB,m\_sDB); AfxGetApp()->WriteProfileString("Connection", "Database",m\_sDB);
}
//seccond browse button
void CAddEquipDlg::OnBnClickedBrowseequip()
{char szFilters\[\]= "CSV Files (\*.csv)|\*.csv|All Files (\*.\*)|\*.\*||"; CFileDialog fDlg(TRUE, "csv", "\*.csv", OFN\_FILEMUSTEXIST| OFN\_HIDEREADONLY, szFilters, NULL ); if (fDlg.DoModal()==IDOK) { CString bla = fDlg.GetFileTitle(); m\_sEQUIP = fDlg.GetPathName(); } SetCurrentDirectory(m\_sCurDir); SetDlgItemText(IDC\_EQUIP,m\_sEQUIP);
}
It crashes two out of tree times (with a send/don't send error message in release) and this is the debug info
First-chance exception at 0x7ca5159e in AddEquip.exe: 0xC0000005: Access violation reading location 0x62883720.
Unhandled exception at 0x7ca5159e in AddEquip.exe: 0xC0000005: Access violation reading location 0x62883720.eusto wrote:
If i press the frist one, select a file than press the seccond one, my application crashes...
What happens if you reverse this process? Which of the four statements after
DoModal()
is crashing? Set a breakpoint to find out.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
Did you try displaying a message box before and after your CFileDialog creation? What happens in that case?
Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா
-
eusto wrote:
If i press the frist one, select a file than press the seccond one, my application crashes...
What happens if you reverse this process? Which of the four statements after
DoModal()
is crashing? Set a breakpoint to find out.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
None of the four statements after DoModal() is crashing!..none! DoModal() doesn't even return. Anyways, i've narrowed it down. It crashes when i move trough folders in the CFileDialog window. And it doesn't really matter wich of the two buttons i press first.
-
None of the four statements after DoModal() is crashing!..none! DoModal() doesn't even return. Anyways, i've narrowed it down. It crashes when i move trough folders in the CFileDialog window. And it doesn't really matter wich of the two buttons i press first.
This is just a complete guess, but how about commenting out everything after the
DoModal()
call?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
This is just a complete guess, but how about commenting out everything after the
DoModal()
call?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
this was my last resort too but it still failed :(. I'm putting this thing to rest and i'll get to it some other time... Maybe there's a problem with my computer( a virus or smth...don't know ). The problem is clearly in the CFileDialog class but i can't figure it out.
-
this was my last resort too but it still failed :(. I'm putting this thing to rest and i'll get to it some other time... Maybe there's a problem with my computer( a virus or smth...don't know ). The problem is clearly in the CFileDialog class but i can't figure it out.
eusto wrote:
The problem is clearly in the CFileDialog class...
To further verify that, use
GetOpenFileName()
instead.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
eusto wrote:
The problem is clearly in the CFileDialog class...
To further verify that, use
GetOpenFileName()
instead.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
eusto wrote:
The problem is clearly in the CFileDialog class...
To further verify that, use
GetOpenFileName()
instead.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb