Click here to Skip to main content
15,918,967 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMFC ActiveX with 2 Controls Pin
Stewart8113-Apr-06 13:01
Stewart8113-Apr-06 13:01 
Questionvector<bool> can't convert to 'bool *'? Pin
Yonggoo13-Apr-06 11:31
Yonggoo13-Apr-06 11:31 
QuestionHow to disable persistient scrollbars (VC++, no MFC) Pin
chasetoys13-Apr-06 10:15
chasetoys13-Apr-06 10:15 
AnswerRe: How to disable persistient scrollbars (VC++, no MFC) Pin
Sheng Jiang 蒋晟13-Apr-06 11:50
Sheng Jiang 蒋晟13-Apr-06 11:50 
QuestionWhich part of the O.S Supports Multithreading? Pin
CodeVarma13-Apr-06 8:07
CodeVarma13-Apr-06 8:07 
AnswerRe: Which part of the O.S Supports Multithreading? Pin
John M. Drescher13-Apr-06 8:34
John M. Drescher13-Apr-06 8:34 
AnswerRe: Which part of the O.S Supports Multithreading? Pin
ThatsAlok13-Apr-06 8:39
ThatsAlok13-Apr-06 8:39 
QuestionFirst-chance exception CFileDialog Pin
RobJones13-Apr-06 7:34
RobJones13-Apr-06 7:34 
Hello,
I am having a proglem with "First-chance exception" when displaying a CFileDialog...

Here is the code I am using to display the dialog.
void CExcludeDlg::OnBnClickedBImport()
{
	UpdateData(TRUE);

	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)
	{
		CWaitCursor c;

		CString strFilePath	= m_ldFile.GetPathName(),
				strLine		= _T("");

		// Open the LUL and pass the data to the parser
		// Read the file and dump the data into strData
		CStdioFile file(strFilePath, CFile::modeRead | CFile::shareDenyNone);

		// Parse the data and populate the vector
		while(file.ReadString(strLine))
		{
			BOOL bFound = FALSE;
			strLine.Trim();
			
			// Only add unique names
			POSITION pos = m_strStringList.GetHeadPosition();
			while(pos)
			{
				if(!strLine.CompareNoCase(m_strStringList.GetAt(pos)))
					bFound = TRUE;

				m_strStringList.GetNext(pos);
			}

			if(!bFound)
				m_strStringList.AddTail(strLine);
		}

		// Empty out the edit control
		m_strList.Empty();

		// Populate the edit control with our string list
		POSITION pos = m_strStringList.GetHeadPosition();
		while(pos)
		{
			m_strList += (m_strStringList.GetAt(pos) + _T("\r\n"));

			m_strStringList.GetNext(pos);
		}

		// Update the status pane with the size of our string list
		m_strStatus.Format(_T("Count: %d"), m_strStringList.GetCount());
	}

	UpdateData(FALSE);
}


Here is the error in debug mode.
First-chance exception at 0x7ca51406 in SiteConsole.exe: 0xC0000005: Access violation reading location 0x016d49c8.
Unhandled exception at 0x7ca51406 in SiteConsole.exe: 0xC0000005: Access violation reading location 0x016d49c8.


Here is the disassembly point where it breaks.
7CA51406 mov ecx,dword ptr [eax]


Any ideas??

Whoever said nothing's impossible never tried slamming a revolving door!
AnswerRe: First-chance exception CFileDialog Pin
David Crow13-Apr-06 7:41
David Crow13-Apr-06 7:41 
GeneralRe: First-chance exception CFileDialog Pin
RobJones13-Apr-06 8:23
RobJones13-Apr-06 8:23 
QuestionRe: First-chance exception CFileDialog Pin
David Crow13-Apr-06 9:43
David Crow13-Apr-06 9:43 
AnswerRe: First-chance exception CFileDialog Pin
RobJones13-Apr-06 10:23
RobJones13-Apr-06 10:23 
GeneralRe: First-chance exception CFileDialog Pin
RobJones13-Apr-06 9:01
RobJones13-Apr-06 9:01 
GeneralRe: First-chance exception CFileDialog Pin
David Crow13-Apr-06 9:41
David Crow13-Apr-06 9:41 
GeneralRe: First-chance exception CFileDialog Pin
RobJones13-Apr-06 10:22
RobJones13-Apr-06 10:22 
GeneralRe: First-chance exception CFileDialog Pin
David Crow13-Apr-06 10:42
David Crow13-Apr-06 10:42 
AnswerRe: First-chance exception CFileDialog Pin
georgeraafat13-Apr-06 7:48
georgeraafat13-Apr-06 7:48 
GeneralRe: First-chance exception CFileDialog Pin
RobJones13-Apr-06 8:06
RobJones13-Apr-06 8:06 
GeneralRe: First-chance exception CFileDialog Pin
georgeraafat13-Apr-06 8:26
georgeraafat13-Apr-06 8:26 
GeneralRe: First-chance exception CFileDialog Pin
RobJones13-Apr-06 8:44
RobJones13-Apr-06 8:44 
AnswerRe: First-chance exception CFileDialog Pin
RobJones13-Apr-06 10:46
RobJones13-Apr-06 10:46 
Questionhow to close or recycle "FILE f_ptr" after using it Pin
mrby12313-Apr-06 6:46
mrby12313-Apr-06 6:46 
QuestionRe: how to close or recycle "FILE f_ptr" after using it Pin
David Crow13-Apr-06 7:09
David Crow13-Apr-06 7:09 
AnswerRe: how to close or recycle &quot;FILE f_ptr&quot; after using it Pin
mrby12313-Apr-06 7:17
mrby12313-Apr-06 7:17 
GeneralRe: how to close or recycle &amp;quot;FILE f_ptr&amp;quot; after using it Pin
David Crow13-Apr-06 7:37
David Crow13-Apr-06 7:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.