Home > Software engineering >  Create a thread in the error C3867: "MTG8: : WriteW" function call lack of parameter list;
Create a thread in the error C3867: "MTG8: : WriteW" function call lack of parameter list;

Time:10-07

The static UINT WriteW (LPVOID pParam)
{
PParam CEdit * pEdit=(CEdit *);
PEdit - & gt; SetWindowText (" ");
Critical_secton. The Lock ();
for (int i=0; i<10; I++)
{
G_Array [I]='W';
PEdit - & gt; SetWindowText (g_Array);
Sleep (1000);
}
Critical_secton. Unlock ();
return 0;
}

Void MTG8: : OnBnClickedWritew ()
{
CWinThread * pWriteW=AfxBeginThread (WriteW, & amp; M_ctrlW, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);
PWriteW - & gt; ResumeThread ();
}
Recently in a multithreaded, follow the example of made several multithreading, before doing this is no problem, to this case suddenly appeared this problem, program, are said to search on the net have to use a static member function, I just in front of the function to add a static, is still the same problem, solving

CodePudding user response:

 
AfxBeginThread (WriteW, (LPVOID) & amp; M_ctrlW, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);

CodePudding user response:

Thanks, upstairs, I just try, still the same error message pop up

CodePudding user response:

reference 1st floor oyljerry response:
 
AfxBeginThread (WriteW, (LPVOID) & amp; M_ctrlW, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);

Is still the same error

CodePudding user response:

reference lionhenryzxxy reply: 3/f
Quote: refer to 1st floor oyljerry response:

 
AfxBeginThread (WriteW, (LPVOID) & amp; M_ctrlW, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);

Is still the same error

Remove the static, then function definition as the requirements of the thread

CodePudding user response:

Look at the function definition:
CWinThread * AFXAPI AfxBeginThread (AFX_THREADPROC pfnThreadProc, LPVOID pParam,
Int nPriority=THREAD_PRIORITY_NORMAL, UINT nStackSize=0,
DWORD dwCreateFlags=0, LPSECURITY_ATTRIBUTES lpSecurityAttrs=NULL);
CWinThread * AFXAPI AfxBeginThread (CRuntimeClass * pThreadClass,
Int nPriority=THREAD_PRIORITY_NORMAL, UINT nStackSize=0,
DWORD dwCreateFlags=0, LPSECURITY_ATTRIBUTES lpSecurityAttrs=NULL);

M_ctrlW this is controls a pointer or a control entity, you confirm, the estimate is identified become the second
Multi-threaded use AfxBeginThread, used in the thread window control will lead to all sorts of problems, such a development is not recommended,
It is recommended to use a separate thread, USES the message mechanism,

CodePudding user response:

Oyljerry
reference 4 floor response:
Quote: refer to the third floor lionhenryzxxy response:
Quote: refer to 1st floor oyljerry response:

 
AfxBeginThread (WriteW, (LPVOID) & amp; M_ctrlW, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);

Is still the same error

Remove the static, then function is defined as the requirements of the thread


This also tried, it is still a question, this is my function definition

CodePudding user response:

reference 5 floor nudt312 reply:
look at the function definition:
CWinThread * AFXAPI AfxBeginThread (AFX_THREADPROC pfnThreadProc, LPVOID pParam,
Int nPriority=THREAD_PRIORITY_NORMAL, UINT nStackSize=0,
DWORD dwCreateFlags=0, LPSECURITY_ATTRIBUTES lpSecurityAttrs=NULL);
CWinThread * AFXAPI AfxBeginThread (CRuntimeClass * pThreadClass,
Int nPriority=THREAD_PRIORITY_NORMAL, UINT nStackSize=0,
DWORD dwCreateFlags=0, LPSECURITY_ATTRIBUTES lpSecurityAttrs=NULL);

M_ctrlW this is controls a pointer or a control entity, you confirm, the estimate is identified become the second
Multi-threaded use AfxBeginThread, used in the thread window control will lead to all sorts of problems, such a development is not recommended,
It is recommended to use a separate thread, USES the message mechanism,

M_ctrlW, is MFC edit box CEDIT variables

CodePudding user response:

refer to 7th floor lionhenryzxxy response:
m_ctrlW, is MFC edit box CEDIT variable


I know this is a CEDIT, look at this is CEDIT is new, or directly defined,

CodePudding user response:

Multiple Threads in the User Interface of http://msdn.microsoft.com/zh-cn/library/ms810439.aspx

CodePudding user response:

refer to the eighth floor nudt312 response:
Quote: refer to 7th floor lionhenryzxxy response:

M_ctrlW is MFC edit box CEDIT variable


I know this is a CEDIT, look at this is CEDIT is new, or directly defined,

Direct definition of

CodePudding user response:

references to the tenth floor lionhenryzxxy response:
Quote: refer to the eighth floor nudt312 response:

Quote: refer to 7th floor lionhenryzxxy response:

M_ctrlW is MFC edit box CEDIT variable


I know this is a CEDIT, look at this is CEDIT is new, or directly defined,

nullnullnullnullnull
  • Related