I am trying to send an HWND with the WM_COPYDATA IPC method. So far when sending a string LPCTSTR it works.
LPCTSTR str = L"Test";
COPYDATASTRUCT cds;
cds.dwData = 20;
cds.cbData = sizeof(TCHAR) * wcslen(str);
cds.lpData = (PVOID)str;
LRESULT l = SendMessage(myhWnd, WM_COPYDATA, (WPARAM)nullptr, (LPARAM)&cds);
But when using the HWND the message doesn't even arrive...
COPYDATASTRUCT cds;
cds.dwData = 20;
cds.cbData = sizeof(HWND);
cds.lpData = (PVOID)targetWnd;
LRESULT l = SendMessage(myhWnd, WM_COPYDATA, (WPARAM)nullptr, (LPARAM)&cds);
A PVOID should be able to point at anything afaik.
My HWNDs are both set and both of the methods above return 0 as LRESULT. How do I debug this? Or is there something fundamentally wrong?