void SendDataFromWorkerThread(HWND 句柄)
{
int *x = new int(10);
::PostMessage(handle, user_defined_message_id, 0, (LPARAM)x);
}
在不同线程上接收时..
void GetDataFromWorkerThread(WPARAM wparam,LPARAM lparam)
{
int *x = (int*) lparam;
// But it does not give the right data.
// It gives 0 at that memory address.
//( Also memory Address pointed by lparam is different from what was sent)
}
我的应用程序是单线程,我将一些工作(返回一些数据,高于 x 值 "10" )委派给工作线程。我正确地收到了消息,但没有收到数据。