Discussion:
Access violation after adding a member variable
(too old to reply)
Weichao Wang
2010-02-22 12:45:01 UTC
Permalink
Hi all,
After I've assigned a variable to an edit control, the project can be
compiled without error, but at execution an error occurs:
Unhandled exception in prog.exe: 0xC0000005: Access Violation.
The program stopped within the method InitInstance() in the code line:
m_pMainWnd = &dlg;
i.e. the program does not reach my own code.
This is in Visual C++ 6.0.
Has someone a clue for this? many thanks in advance!
--
Weichao Wang
Scott McPhillips [MVP]
2010-02-22 14:04:19 UTC
Permalink
Post by Weichao Wang
Hi all,
After I've assigned a variable to an edit control, the project can be
Unhandled exception in prog.exe: 0xC0000005: Access Violation.
m_pMainWnd = &dlg;
i.e. the program does not reach my own code.
This is in Visual C++ 6.0.
Has someone a clue for this? many thanks in advance!
--
Weichao Wang
Single step into the problem area with the debugger. One possibility is
that the previous line of code created dlg, which means it executed any code
you may have in the dlg constructor.
--
Scott McPhillips [VC++ MVP]
Alexander Grigoriev
2010-02-22 14:50:18 UTC
Permalink
Try to do full rebuild. Sometimes changes in .h files don't trigger build of
all affected sources.
Post by Weichao Wang
Hi all,
After I've assigned a variable to an edit control, the project can be
Unhandled exception in prog.exe: 0xC0000005: Access Violation.
m_pMainWnd = &dlg;
i.e. the program does not reach my own code.
This is in Visual C++ 6.0.
Has someone a clue for this? many thanks in advance!
--
Weichao Wang
Weichao Wang
2010-02-22 21:15:01 UTC
Permalink
That's the point! Thank you, Alexander!
--
Weichao Wang
Post by Alexander Grigoriev
Try to do full rebuild. Sometimes changes in .h files don't trigger build of
all affected sources.
Post by Weichao Wang
Hi all,
After I've assigned a variable to an edit control, the project can be
Unhandled exception in prog.exe: 0xC0000005: Access Violation.
m_pMainWnd = &dlg;
i.e. the program does not reach my own code.
This is in Visual C++ 6.0.
Has someone a clue for this? many thanks in advance!
--
Weichao Wang
.
Loading...