Three click event, please, MFC will merge into a click event, and execute sequentially, for example,
Afx_msg void OnClickedBtn1 ();
Afx_msg void OnClickedBtn2 ();
Afx_msg void OnClickedBtn3 ();
Afx_msg void OnClickedBtnAll ();
Now want to OnClickedBtnAll () the click event will OnClickedBtn1 (); , OnClickedBtn2 (); , OnClickedBtn3 (); The three click event, and perform in accordance with the order, and in these three click event, have multiple threads inside,
It is the method I use:
//method 1
Int CTestDlg: : clickedBtn1 ()
{
OnClickedBtn1 ();
return 1;
}
Int CTestDlg: : clickedBtn2 ()
{
OnClickedBtn2 ();
return 1;
}
Int CTestDlg: : clickedBtn3 ()
{
OnClickedBtn3 ();
return 1;
}
Void CTestDlg: : OnClickedBtnAll ()
{
Do {
Int retValue=(https://bbs.csdn.net/topics/clickedBtn1);
If (retValue=1) https://bbs.csdn.net/topics/=
{
RetValue=(https://bbs.csdn.net/topics/clickedBtn2);
If (retValue=1) https://bbs.csdn.net/topics/=
{
RetValue=(https://bbs.csdn.net/topics/clickedBtn3);
If (retValue=1) https://bbs.csdn.net/topics/=
{
AfxMessageBox (_T (" executed "));
}
The else
{
break;
}
}
The else
{
break;
}
}
The else
{
break;
}
} while (0);
}
//method 2
Through a custom message SendMessage the click event, in inside, then, until it is completed, again hair under a custom message, click event is as follows:
The SendMessage (MYWM_BTN1_STATUS, NULL, NULL);
ON_MESSAGE (MYWM_BTN1_STATUS, & amp; CTestDlg: : OnMywmClickedBtn1)
ON_MESSAGE (MYWM_BTN2_STATUS, & amp; CTestDlg: : OnMywmClickedBtn2)
ON_MESSAGE (MYWM_BTN3_STATUS, & amp; CTestDlg: : OnMywmClickedBtn3)
Afx_msg LRESULT CTestDlg: : OnMywmClickedBtn1 (WPARAM WPARAM, LPARAM LPARAM)
{
OnClickedBtn1 ();
The SendMessage (MYWM_BTN2_STATUS, NULL, NULL);
return 0;
}
Afx_msg LRESULT CTestDlg: : OnMywmClickedBtn2 (WPARAM WPARAM, LPARAM LPARAM)
{
OnClickedBtn2 ();
The SendMessage (MYWM_BTN3_STATUS, NULL, NULL);
return 0;
}
Afx_msg LRESULT CTestDlg: : OnMywmClickedBtn3 (WPARAM WPARAM, LPARAM LPARAM)
{
OnClickedBtn3 ();
return 0;
}
Not according to the order of above, the first one to implement, the second method according to the click event in the order, but can lead to the MFC program, the phenomenon of the jammed,
Give a big, could you tell me what better way to realize or how to solve this problem? Also hope to have an experienced bosses can give some help or advice, I appreciate!!!!!