How to get string thru lParam in window message
Hi All,
I have two dialog based applications in which first dialog has implemented a user message, with wParam and lParam as parameter.
Now from other dialog based application I want to send the above user message to get a string value. (It is somewhat similar to WM_GETTEXT message)
I have implemented code like this
Application 2:-
Code:
void SomeFunction()
{
CWnd* pWnd = FindWindow(); // Find the Application 1's Window (i.e. CUsrSNDlg)
TCHAR pname[100];
memset(pname, '\0', sizeof(TCHAR)*100);
pWnd->SendMessage(WM_USR_GETNAME, 0, (LPARAM)(LPCTSTR)pname);
}
Application 1:-
Code:
LRESULT CUsrSNDlg::OnUsrGetName(WPARAM wParam, LPARAM lParam)
{
::CopyMemory((LPVOID)lParam, m_UsrName, 100); // Here copy fails as this is a address of other appln's address space
return TRUE;
}
Here I want to use lParam as an out parameter to send a string value back.
Can anyone please tell me that how can I get string value in lParam?
Regards,
Tushar