F
figsys
I am looking for a simple wrapper or mechanism to send a boost
smart_ptr using WIN32 PostMessage (or PosthreadMessage). The smart_ptr
should be incremented when sent and decremented when received (or
derefenced).
WIN32 is not "C++ enabled" and thus does not allow to cast a smart_ptr
into an LPARAM or WPARAM.
Something like
DWORD nID;
HANDLE m_hBxTxThread = CreateThread (NULL, 0, MyThread, NULL, 0, &nID);
boost::smart_ptr<MyObject> pSmart( new MyObject);
pSmart->Set(100);
PostThreadMessage( nID, 0, 0, (LPARAM) pSmart );
does not work - can convert smart_ptr to LPARAM. This works but defeats
the point since reference is not incremented:
PostThreadMessage( nID, 0, 0, (LPARAM) &pSmart )
Thanks!
smart_ptr using WIN32 PostMessage (or PosthreadMessage). The smart_ptr
should be incremented when sent and decremented when received (or
derefenced).
WIN32 is not "C++ enabled" and thus does not allow to cast a smart_ptr
into an LPARAM or WPARAM.
Something like
DWORD nID;
HANDLE m_hBxTxThread = CreateThread (NULL, 0, MyThread, NULL, 0, &nID);
boost::smart_ptr<MyObject> pSmart( new MyObject);
pSmart->Set(100);
PostThreadMessage( nID, 0, 0, (LPARAM) pSmart );
does not work - can convert smart_ptr to LPARAM. This works but defeats
the point since reference is not incremented:
PostThreadMessage( nID, 0, 0, (LPARAM) &pSmart )
Thanks!