Question : Restoring a CString From a LPARAM

I am trying to pass data between two applications via SendMessage.

I can pass integers back and forth fine, but I am have problems passing any char data.


CWnd* pWnd = CWnd::FromHandle(hWnd);

char *text =  "this won't come through";  // doesn't work
int x = 90;  // passes fine

pWnd->SendMessage( MY_MESSAGE, (WPARAM) x, (LPARAM), text);




LRESULT CMainFrame::OnExternalMessage(WPARAM wParam, LPARAM lParam)
{

   // wParam is OK
   
    CString FileName = (char *) lParam;
   
  //   FileName  is  = ""  no good


What am I doing wrong ?

Thanks,

-Eric

Answer : Restoring a CString From a LPARAM

Two applications have their own process address space. You need an Interprocess Communication (IPC) mechanism. In your case, use WM_COPYDATA.
Random Solutions  
 
programming4us programming4us