c++ - MFC Send the object in message -
can send message object? like:
myclass *myobj = new myclass(); pdlg->sendmessage(myevent, null, (lparam)&myobj); // sends without errors ... afx_msg lresult myapp::getevent(wparam wparam, lparam lparam) { myclass *zxc = new myclass(); zxc = lparam; // this... doesn't work }
just cast pointer there-and-back 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); // ... }
Comments
Post a Comment