? Return values from a Dialog App 
Author Message
 ? Return values from a Dialog App

    Hi,

    I've got an MFC dialog app, and need a way of returning a value when the
app ends.  I want to return which button was clicked for use in a batch
file.  MFC puts this comment in the app:

// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.

    So how do I return a value?

Thanks.

--
Alec



Mon, 29 Nov 2004 00:02:32 GMT  
 ? Return values from a Dialog App
EndDialog([id of the button pressed])

This will be the value returned by DoModal()

Good luck
-- BW


Quote:
>     Hi,

>     I've got an MFC dialog app, and need a way of returning a value when
the
> app ends.  I want to return which button was clicked for use in a batch
> file.  MFC puts this comment in the app:

> // Since the dialog has been closed, return FALSE so that we exit the
> // application, rather than start the application's message pump.

>     So how do I return a value?

> Thanks.

> --
> Alec




Mon, 29 Nov 2004 00:40:24 GMT  
 ? Return values from a Dialog App
If you are using MFC dialog-based app wizard, before this line, you can see
the program call dlg.DoModal().  After that, you can check the return value
to see which button you have clicked to end the dialog.

Best regards,
yhhuang
VS.NET, Visual C++
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net?  http://www.gotdotnet.com



Mon, 29 Nov 2004 03:23:45 GMT  
 ? Return values from a Dialog App
In addition to your other replies, take a look at CWinApp::ExitInstance.

--
Jeff Partch [MVP]

Quote:

>     Hi,

>     I've got an MFC dialog app, and need a way of returning a value when the
> app ends.  I want to return which button was clicked for use in a batch
> file.  MFC puts this comment in the app:

> // Since the dialog has been closed, return FALSE so that we exit the
> // application, rather than start the application's message pump.

>     So how do I return a value?

> Thanks.

> --
> Alec




Mon, 29 Nov 2004 04:10:27 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. return a value when an MFC dialog-based app exits

2. Return value in multi-threaded app?

3. GetClientRect returns different values each time app is run

4. FindFirstFile return-value crashes my app

5. ? Dialog return value

6. How to return a value from a modal dialog box

7. Returning Value(s) from a Dialog

8. Returning value from Dialog Application

9. Visual C++ : Passing values from a Dialog to Doucument/View in an SDI app

10. Urgent!!! ---- return control to Dialog app

11. Dialog App and return key

12. App closes after Dialog box returns

 

 
Powered by phpBB® Forum Software