1. The existing dialog box is as follows:
Click the button to bring up the Hello message box, as shown in:
The following code simulates the click RESPONSE event when you click the button:
Void ctestdlg: onbnclickedbtntest ()
{
// Todo: add your control notification handler code here
Wparam;
Wparam = bn_clicked;
Wparam <= 16; // shifts 16 bits to the left
Wparam | = idc_btn_say_hello; // bitwise OR
Lparam;
Lparam = (lparam): getdlgitem (this-> getsafehwnd (), idc_btn_say_hello );
: Postmessage (this-> getsafehwnd (), wm_command, wparam, lparam );
}
In this way, the Hello message box will pop up when you click the button.
II. The following two dialogs are available: test.exeand hisin.exe.
Click the button to bring up the Hello message box, as shown in:
Click the button in the hisin dialog box to simulate the click event in the test dialog box. The implementation code is as follows:
Void chisindlg: onbnclickedbtntest ()
{
// Todo: add your control notification handler code here
Hwnd hwnddlgtest =: findwindow (null, text ("test "));
Hwnd hwndbtnsayhello =: find1_wex (hwnddlgtest, null, null, text ("Say hello "));
Wparam;
Wparam = bn_clicked;
Wparam <= 16; // shifts 16 bits to the left
Wparam | =: getdlgctrlid (hwndbtnsayhello );
Lparam;
Lparam = (lparam) hwndbtnsayhello;
: Postmessage (hwnddlgtest, wm_command, wparam, lparam );
}
In this way, clicking the button in the hisin dialog box will bring up the Hello message box in the test dialog box.