ramesh_mirpuri
asked on
Sending messages to child windows from dialog box in another class
Hi...
I need to know how for example to create a new child window in an mdi application from a click on a button in a modeless
dialog box with its own class
and not by..clicking the menu buttons or toolbar buttons. Do i have to post messages to my main frame/client window then
send messages to my child window again....
please please help...i'm stuck
p.s i'm using visualc++, mdi class wizard to create my program
I need to know how for example to create a new child window in an mdi application from a click on a button in a modeless
dialog box with its own class
and not by..clicking the menu buttons or toolbar buttons. Do i have to post messages to my main frame/client window then
send messages to my child window again....
please please help...i'm stuck
p.s i'm using visualc++, mdi class wizard to create my program
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I would say you would in general be better off using RegisterWindowsMessage for your unique message ID's. if you use that API you are guaranteed uniqueness.... If you use the WM_USER+... there is a chance you may walk on something else or vice versa.. If a different app uses the same one you pick and happens to use HWND_BROADCAST you would then respond to his message thinking its your message. RegisterWindowsMessage is a better way to go.
If the user presses a button, you should create the window at that point in time. If you choose to send messages, its better to use the PostMessage api to do it. Why? its asynchronous when you do it that way
In your MainFrm.cpp file take a look in classwizard for
ID_FILE_OPEN
use it to create a function. You basically want this functionality to execute whenever this event is suppsoed to happen.