Re: theApp.ExitInstance(); returns 20 - what does this mean?
"Scot Brennecke" <ScotB@spamhater.MVPs.org> wrote in message
news:eRgXQOQYKHA.3696@TK2MSFTNGP02.phx.gbl...
Just some minor corrections, although the bulk of your answer is on
target. CWinApp is derived from CWinThread, and when InitInstance returns
false, this leads to a call to pThread->ExitInstance. This becomes a call
to CWinApp::ExitInstance. If AfxGetCurrentMessage returns a non-NULL
current MSG pointer, then ExitInstance will return the wParam from that
message.
Hmm, that's different than how I think it is. I did not think ExitInstance
gets called if InitInstance returns FALSE. If it were, it would be easy:
just override CWinApp::ExitInstance() and return the desired value, which
will be the value returned to the OS when the app exits.
But Joe's reply about it being unusual to care about the return value from
GUI app is appropriate here.
Well, mostly the return value is ignored, but not always. For example, some
GUI apps are typically launched from a script and run in automated mode; the
script would care about the return value to indicate an error in the
automated processing. For example, devenv.exe can be launched with a given
..sln file to do a build, in this case, no UI is shown but the return value
is important. So I don't think you can make a general rule that "The return
value of a GUI app is not important." Especially since you don't know in
advance how your users are going to use your app.
-- David