Reputation: 23
Can i send the message with object? Something like:
myClass *myObj = new myClass();
pDlg->SendMessage(MyEvent, NULL, (LPARAM)&myObj); // Sends without any errors
...
afx_msg LRESULT MyApp::GetEvent(WPARAM wParam, LPARAM lParam)
{
myClass *zxc = new myClass();
zxc = lParam; // Something like this... but doesn't work
}
Upvotes: 1
Views: 1310
Reputation: 477040
Just cast the pointer there-and-back as appropriate:
Sender:
pDlg->SendMessage(MyEvent, NULL, reinterpret_cast<LPARAM>(&myObj));
Receiver:
afx_msg LRESULT MyApp::GetEvent(WPARAM wParam, LPARAM lParam)
{
myClass * zxc = reinterpret_cast<myClass*>(lParam);
// ...
}
Upvotes: 2