Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Return codes of Wordpad / MFC programs

19 views
Skip to first unread message

Matthias Berger

unread,
Dec 13, 1999, 3:00:00 AM12/13/99
to
Hello,


I start the Wordpad from a batch file to print a *.doc file to
a fax printer driver. Via the return code of Wordpad.exe I want
to check if the user has aborted printing or if anything else
happened.

I found return code 12 signaling a user cancellation of printing.


My question is:

(*) Does anybody out here know a complete list of the
return code of the Wordpad.exe ?

(*) Or even better, does anybody know how and where
the return values are created within the MFC ?

Thanks in advance,

Matthias


Sent via Deja.com http://www.deja.com/
Before you buy.

a f f l e s 2@worldnet.att.net Ron Ruble

unread,
Dec 13, 1999, 3:00:00 AM12/13/99
to
No, but the WordPad source is a sample in VC.
Check the sample to see what return codes MS returns.

Matthias Berger wrote in message <832h2d$sni$1...@nnrp1.deja.com>...

Doug Harrison

unread,
Dec 13, 1999, 3:00:00 AM12/13/99
to
Matthias Berger wrote:

>Hello,
>
>
>I start the Wordpad from a batch file to print a *.doc file to
>a fax printer driver. Via the return code of Wordpad.exe I want
>to check if the user has aborted printing or if anything else
>happened.
>
>I found return code 12 signaling a user cancellation of printing.
>
>
>My question is:
>

>(*) Does anybody out here know a complete list of the
>return code of the Wordpad.exe ?

Look into the source. If I was to bet, I would say that your "12" isn't
being returned deliberately to indicate what you think it does.

>(*) Or even better, does anybody know how and where
>the return values are created within the MFC ?

The return code comes from the return value of ExitInstance(). Unless you
override this function and return what you want, it's fairly random. For
example, a dialog-based MFC app that doesn't override ExitInstance() tends
to return 13, which corresponds to the user pressing Enter to exit the
dialog. (13 is the keycode for Enter.) Other types of MFC apps should return
whatever value was passed to PostQuitMessage(), which tends to be zero,
because MFC calls this function for you when you close the main window. Your
best bet is to override CWinApp::ExitInstance(), which by default, returns
the WPARAM of the last message dequeued and processed by the MFC message
loop:

int MyApp::ExitInstance()
{
CWinApp::ExitInstance();
return myCode;
}

--
Doug Harrison
dHar...@worldnet.att.net
Visual C++ MVP

0 new messages