I have two VC++ applications running, both written by me. They are not two instances of the same EXE; they are completely different projects. I want to send a string from one to the other.
First application has the following code:
HWND tgtHwnd = FindWindow(_T("Target_Class"), _T("Target_Name"));
SendMessage(tgtHwnd, 1234, 0, (LPARAM)L"Hello");
The second has the following code to process this message:
// snippet of the WndProc function
case 1234:
LPCWSTR myText = (LPCWSTR)lParam;
MessageBox(NULL, myText, _T("My Text"), 0);
// End snippet
When I run it, and pass the message, I get an access violation error in the receiving application.

Tried to search conversion to and from LPCWSTR and LPARAM, but couldn't find any helpful example. Even more confused with the Bad Ptr error. I remember reading that the pointer that is sent might not be available to the second process or something like that. But I have no clue where to start looking.
How can I send the string from one EXE to another?