Click here to Skip to main content
15,899,563 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My first dialog is modal, but the second one is not. So when i call it, the first doesn't close. I think while the first is "alive", the second might be able to receive the variable value. Right?
Posted
Updated 1-Mar-10 9:40am
v5

Either send a custom windows message to the hWnd of the second and have a message handler for it in the second, or have the first call a public method of the CDialog derived object of the second.

However, if I recall correctly from a previous question of yours, you are starting the second dialog as a modal dialog from the first. That means that the first dialog will effectively be suspended while the second is running. It will never get any keystrokes while the second is open. In my (mis)understanding of what you are doing, you are coding for a situation that your design specifically precludes from ever occurring.


ge6a93 later wrote:
My first dialog is modal, but the second one is not.


Good. :)

If, by chance, this is a value that you want to use to initialize your second dialog when you create it, then write the constructor of your second dialog's class to accept it as a parameter.


If your first dialog created the second, it has (or at least had) access to the CDialog derived object instance associated with the second dialog. Then, as long as second dialog still exists, you could use either of the suggestions in my first paragraph to send the value to the second dialog.
 
Share this answer
 
v2
You can set and get your data variables in the DoDataExchange() function of your CDialog objects.
 
Share this answer
 
You could hold, modify and request your "exchange data"
at the application object too :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900