CodePudding user response:
Implement several interface function in the class,CodePudding user response:
Passing the class pointer as a function parameters, such as in the pastCodePudding user response:
The function is called different threads, they belong to different threads, as long as it is, you must ensure that synchronization, using the simplest critical region synchronizationCodePudding user response:
To the relevant parameters as the callback function, or do you define a global or static members, the callback function can access to the can,CodePudding user response:
Shared data as long as the data set to global variables, parameters can also beOnly once can set a global variable
Such as
Int tis=0;//define a global variable
If (tis==0)
{
//do you want to execute statements
Tis++;
}//in the callback function
CodePudding user response:
The incoming class pointer, the static or global objectCodePudding user response:
1
2
3
4
5
6
7
8
9
10
11.
12
13
14
15
16
Void CCashUnitAgeTestDlg: : OnOK ()
{
AfxBeginThread (ProcRunThread, (LPVOID) this);//the incoming object pointer
}
Void CCashUnitAgeTestDlg: : vShowResult (LPCTSTR p_pcTestInfo)
{
.
}
UINT ProcRunThread (LPVOID pParam)
{
//conversion
PParam CCashUnitAgeTestDlg * pDlg=(CCashUnitAgeTestDlg *);
PDlg - & gt; VShowResult ()
}