Hi,
I need to pass the character array or char* to the another process through BroadcastSystemMessage() API. If I use WPARAM for this, I get the junk address in the recieving process.I am doing something like this
Sender
RecieverCode:.. char szTemp[32]={0}; strcpy(szTemp,"TEST"); ULONG uiMsg = RegisterWindowMessage(KP_EXPORT_STATUS_MSG); DWORD dwRecipients = BSM_APPLICATIONS; DWORD dwFlags = BSF_FORCEIFHUNG | BSF_POSTMESSAGE; BroadcastSystemMessage( BSF_FORCEIFHUNG|BSF_POSTMESSAGE, &dwRecepients, iServerFileFailure, (WPARAM)temp, 0); ...
Later I figured out that, pointers are meaningless between two processes as they will be having different process space. But it works if i send an interger as WPARAM instead of pointer.Code:ULONG uiMsg = RegisterWindowMessage(KP_EXPORT_STATUS_MSG); DWORD dwRecipients LRESULT CALLBACK WndMainProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { if( message == uiMsg ) { char* szTemp = (char*)wParam; //szTemp is junk here }
I need to pass a string to another process. Is there any workaround for this problem??
Thanks




Reply With Quote