Archived

This topic is now archived and is closed to further replies.

BungoMan85

sending data between dialog classes

Recommended Posts

i got a dialog class (mfc of course...) and when a button is pressed it creates a child dialog of another class, how can i make it so i can send data from a text input from the child window back to the parent? this->GetParent()->text="blah" for example (assuming text is a member of the parent dialog class). for some reason it dont like that. im assuming its because any dialog (one with or without the variable in question) could actualy create this dialog. im at a loss here tho, i thought about sending a message to the parent and making it so that it handles the message in the appropriet way... but i doubt thats a good idea... Bungo!

Share this post


Link to post
Share on other sites
All you really need for sending messages to another dialog (window, hwnd) is the HWND handle (or the CWnd encapsulation class of MFC). Keep a handle to it when creating your dialog and you can go on sending whatever you want.

Share this post


Link to post
Share on other sites
well the GetParent() function takes care of that for me (it returns a CWnd if im not mistaken). i just figured that was kind of a sloppy method.

Bungo!

Share this post


Link to post
Share on other sites