Problem when Invoking SendMessage() between two Windows Apps.. Please Help..
#define TEST_MSG WM_USER + 1
2) The Message data Structure Declared [ In both The Application ]
class msgData
{
public:
int msgNo;
CString data;
};
3) Window1 in App1 Sending the Message
void CTesterDlg::OnButton1()
{
HWND hw = ::FindWindow(0, "TestDCLeak") ;
msgData * data = new msgData();
data->data = "Sample Message" ;
data->msgNo = 20 ;
::SendMessage(hw, TEST_MSG, (WPARAM) data , 0 );
}
4) The Following Message Map is Added in the AFX_MSG_MAP Section of the App2:
ON_MESSAGE (TEST_MSG, OnTest )
5) The Linkage b/t the Handler and the Message is Done as Follows [ In App 2] :
afx_msg LRESULT OnTest(WPARAM wParam, LPARAM lParam);
6) Window 2 in App2 Receiving the Message
LRESULT CTestDCLeakDlg::OnTest(WPARAM wParam, LPARAM lParam)
{
msgData * theData = (msgData * ) wParam ;
AfxMessageBox(theData->data);
return 0;
}
* I can Find the App2 Message is Handler is Invoked & the pointer thedata in App2 is Equal to pointer
data in App1.
* But, I can't Able the get the data packed in App1, inside the App2..
Can Anybody Please Explain why this is Happened? What Correction I should take in Code?

