Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
2.75/5 (4 votes)
See more:
Hi All,
Last 20 days i spend my every morning to solved this exception but i can't get it.
Before i asked my question, let me inform you about my plateform of developement
1)Operating System:-Window 2003 server edition<br />
2)Microsoft visual studio 2003<br />
3)MFC Dialog based Application

______________________________________________________________________
Now,
I have one utility that take Three file from user as input.
1)BIL OF MATERIAL<br />
2)SALES PLAN<br />
3)MRP DETAILS

And on the basis of this file i genarate A Master file.

Concept working so far fine but as i allows user to enter 3 file.
so, I ask the user to select file from a CFileDialog.
There are 3 edit box and 3 browse button to do so.
Now,
When i select first file with file dailog say BIL_1.csv(*.CSV Excel file format)
File selected correctly.
But next time i click another Browse button another file dialog opens allows user to select next file but while selecting next file if my focus goes on BIL_1.csv(Previously selected file).
then instead of showing TOOLTIP text a UNHADLE EXCEPTION Came.
Unhadled Exception at 0x7c95a8ad in sapUtility.exe 0xC0000005:Access violation reading location 0x010f3850
SapUtility.exe is my project name.
A on click of break.
7C95A8A7 mov  eax,dword ptr[eax+1C4H]<br />
7C95A8d        mov  eax,dword ptr[eax]<br />

and value of eax is 17774672
__________________________________________________________________
NOTE:-
1)This happen when i select files from DESKTOP.there is lots of shortcuts.
2)This happen only with .csv files utill now.
3)This happen for Tool Tip text shown
4)I dont known this may be very confusing question.
5)May be microsoft BUG.
6)Please review my previous post.
MFC Error: CFileDailog Error of 0x7c95a8ad type exception[^]
________________________________________________________
[EDIT] FOR CODE:
void CSApUtiliy::OnBnClickedButton1()
{
  CFileDialog InputFile_BOM(TRUE,"CSV","*.CSV",OF_HIDEREADONLY|OFN_PATHMUSTEXIST,"csv Files(*.csv)|*.csv|All files(*.*)|*.*||",this);  //constructor
CEdit* Input_FileText=(CEdit*)GetDlgItem(ID_EDIT2);
if(InputFile_BOM.DoModel()==IDOK)
{
  CString PathName=InputFile_BOM.GetPathName();
  Input_FileText.SetWindowText(PathName);
}
}

And For Next Button
void CSApUtiliy::OnBnClickedButton2()
{
  CFileDialog InputFile_Sale(TRUE,"CSV","*.CSV",OF_HIDEREADONLY|OFN_PATHMUSTEXIST,"csv Files(*.csv)|*.csv|All files(*.*)|*.*||",this); //constructor
CEdit* Input_FileText=(CEdit*)GetDlgItem(ID_EDIT1);
if(InputFile_Sale.DoModel()==IDOK)
{
  CString PathName=InputFile_Sale.GetPathName();
  Input_FileText.SetWindowText(PathName);
}
}

__________________________________________________________________
Surly microsoft BUG??
But want solution
All helps are grealty apretiate.
Posted
Updated 26-May-11 19:40pm
v9
Comments
Albert Holguin 25-May-11 0:28am    
yet you're still not showing your code...
[no name] 25-May-11 1:06am    
Note that exception come for only desktop file selection
Albert Holguin 25-May-11 1:12am    
are you selecting a file or a shortcut?
[no name] 25-May-11 1:19am    
I'm selecting file

this is an odd problem (I commonly use CFileDialog() and have never had this problem)... are you sure you're not trying to access these button simultaneously from different threads? ... another thing to try is to allocate and deallocate the heap manually (to see if forcing the deallocation of CFileDialog helps).

Call new CFileDialog() and delete CFileDialog() manually instead of allocating on the stack.

Another thing... why does the break show only assembly? ...if this is a CFileDialog on your dev machine, you should be able to see the code to see where this is breaking. Are you not seeing the problem in Debug or not using a Debugger?
 
Share this answer
 
v3
Comments
[no name] 25-May-11 1:19am    
I have been try this
Albert Holguin 25-May-11 1:19am    
just updated...
[no name] 25-May-11 1:20am    
Is there CFileDialog() constructor taking 0 argument.
Albert Holguin 25-May-11 1:23am    
No, but there is one that takes only 1 argument, the initial argument that specifies the type of CFileDialog... also, try allocating the CString outside of the if() statement, to see if its maybe being deallocated before it gets a chance to be posted
[no name] 25-May-11 1:22am    
UPDATED:
With debug too i goes on Assembly
Try making the calls like this:
void CSApUtiliy::OnBnClickedButton1()
{
  CString PathName;
  CFileDialog InputFile_BOM(TRUE);  //constructor

  CEdit* Input_FileText=(CEdit*)GetDlgItem(ID_EDIT);
  
  if(InputFile_BOM.DoModal()==IDOK)
  {
    PathName=InputFile_BOM.GetPathName();
    Input_FileText->SetWindowText(PathName);
  }
}


if that works, then add arguments into the CFileDialog until you get it to do what you want.
 
Share this answer
 
Comments
[no name] 2-Jun-11 0:35am    
What is difference And CFileDialog not gets one parameter let me remind you
Albert Holguin 2-Jun-11 0:37am    
see, you need to go back and learn a bit more C++...
Albert Holguin 2-Jun-11 0:38am    
...and don't downvote me unless you want me to return the favor...
Albert Holguin 2-Jun-11 0:40am    
Read this http://www.learncpp.com/cpp-tutorial/85-constructors/
[no name] 2-Jun-11 0:40am    
Its ok you give up i new that!!
could you try this?

void CSApUtiliy::OnBnClickedButton1()
{
	CFileDialog InputFile_BOM(TRUE,"CSV","*.CSV",OFN_HIDEREADONLY|OFN_PATHMUSTEXIST,"csv Files(*.csv)|*.csv|All files(*.*)|*.*||",this);  //constructor
	if(InputFile_BOM.DoModal()==IDOK)
	{
		CString PathName=InputFile_BOM.GetPathName();
		GetDlgItem( ID_EDIT2 )->SetWindowText(PathName);
	}
}
And For Next Button
void CSApUtiliy::OnBnClickedButton2()
{
	CFileDialog InputFile_Sale(TRUE,"CSV","*.CSV",OFN_HIDEREADONLY|OFN_PATHMUSTEXIST,"csv Files(*.csv)|*.csv|All files(*.*)|*.*||",this); //constructor
	if(InputFile_Sale.DoModal()==IDOK)
	{
		CString PathName=InputFile_Sale.GetPathName();
		GetDlgItem( ID_EDIT1 )->SetWindowText(PathName);
	}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900