Skip to content

Instantly share code, notes, and snippets.

@wjx0912
Created March 24, 2018 07:33
Show Gist options
  • Save wjx0912/3aa6e06633a6932c712cbfd42e53b32c to your computer and use it in GitHub Desktop.
Save wjx0912/3aa6e06633a6932c712cbfd42e53b32c to your computer and use it in GitHub Desktop.
c++ message object management 1
// send
PostMessage(MyhWnd, CWM_SOME_ERROR, 0, reinterpret_cast<LPARAM>(new string(the_exception.error_string)) );
// receive
LPARAM CMyDlg::OnMyMessage1(WPARAM, LPARAM lParam)
{
// Put in shared_ptr so it is automatically destroyed.
shared_ptr<string> msg = reinterpret_cast<string*>(lParam);
// Do stuff with message
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment