Using VS 2010:
In the old style SDK I would use SendMessage with WM_COMMAND and create a unique ID to be processed in my WM_COMMAND event handler in the main WndProc.
How is this done in MFC (or whatever the code below is)?
I need to access controls on the main form from a dialog box. The dialog box is non-modal, so my main program continues on without waiting for the user to close the box and process the data from the form. Data on the dialog box needs to update a text box on the main form.
Please help! There are lots of answers out there and none of them have worked!
Thanks!
Deaneaux
Code:////////// Main form code ///////////////// #include"stdafx.h" #include"classes.h" #include"frmMsgBox.h" namespace MyApp { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) ... // the label on the main form to be updated is created like this: private: System::Windows::Forms::Label^ label1; ... // A typical event handler: private: System::Void MyButton_Click(System::Object^ sender, System::EventArgs^ e) { } ... // Here is where my dialog box is called: frmMsgBox^ pForm= gcnew frmMsgBox; pForm->Show(); // It has to be non-modal! ShowDialog is not the answer! ... //And in frmMsgBox.h, the dialog box is set up as follows: ////////// Dialog Box code ///////////////// namespace MyApp { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace System::Runtime::InteropServices; public ref class frmMsgBox : public System::Windows::Forms::Form { public: frmMsgBox(void)