DWORD MyThreadProcB(void * p)
{
MSG msg;
PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
while(true)
{
if(GetMessage(&msg,0,0,0))
{
switch(msg.message)
{
case WM_USER + 100:
int a = 0;
break;
}
}
};
return 0;
}
void CmessageDlg::OnBnClickedOk()
{
DWORD threadid;
HANDLE patest = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)MyThreadProcB,NULL ,0,&threadid);
Sleep(1000);
bool a = PostThreadMessage(threadid, WM_USER + 100, 1,2);
OnOK();
}