I've written a program using Visual C++. When I start this program in
release-mode from within Developoer Studio I get an ugly crash. Starting the
program from windows explorer or the debug-version works fine.
the error message says, the instruction at "0x00401d5c" points to memory at
"0x0000008c". "read" not possible.
Whenever I try to debug the program everything works ok. No error.
This is how close I could get to the problem:
In CMyApp::InitInstance() there is the line
if (!ProcessShellCommand(cmdInfo)) return FALSE;
If I place a messagebox somewhere before this line
AfxMessageBox("Test");
the messagebox appears and the program works normally.
If I place my messagebox below that "ProcessShellCommand" I get the
described error.
What is the problem and what can I do?
I'm having this problem since my old Win-NT-AMD-K6 did retire and i got a
new Win2K-Pentium-4. So I thought this might be a time-dependant problem,
but inserting a Sleep(10000) instead of the messagebox didn't help. It must
be something different.
Hope anybody can help.
Greetings,
Joern Weichert.
Some thoughts:
1) Check Debug options for Release build and see if a funky command line
("Program Arguments") is being passed in.
2) It could theoretically still be a timing issue if you're doing complex
stuff. In addition to a delay, AfxMessageBox also pumps messages. (I doubt
it, but you never know.)
3) Compile the Release build with debugging symbols. That way you can at
least look at the stack and figure out what badness is being passed to whom.
4) Something in ProcessShellCommand is causing a crash. So something on the
command line is probably not right (see 1 above). In your message box,
display the command line and what cmdInfo.m_nShellCommand is.
HTH
Jay
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm