how do you get a handle to a modal dialog from outside of the dialogs procedure?
I need to be able to send messages to it.
Thanks.
how do you get a handle to a modal dialog from outside of the dialogs procedure?
I need to be able to send messages to it.
Thanks.
Open source isn't a matter of life or death......
.......its much more important than that!!
SuSE Linux - GCC 3.4.2
XP Pro - Visual Studio 2005 TS, MinGW 3.4.2
Is this dialog part of your application? If so, just save its handle into a global variable, or into a data structure you have access to. Otherwise, you can use FindWindow.
Sometimes accessing a modal dialog is not that easy (ie in MFC using DoModal() ) as the dialog (DoModal call) does not return until the dialog has closed.
I find it easier to set a global variable (or local to the object that wants to send it messages, the 'caller').
I do this in the dialogs init or create message. May require you to send in a pointer to the 'caller'. This can be done by modifing the dialogs constructor.
Usually if you want the application to interact with the dialog, a modeless dialog is used.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
I agree with novacain, better to use a modeless for true interaction with a program. It seems more suited to actually interacting with a dialog than with the more "static" dialog.