passing structures across processes
-
Hi All, I have a structure of CString variabls.I need to pass this variable from one application to other application.I was trying WM_COPYDATA message to pass the data but i'm unable to receive the structure in the destination process.can someone help me out in this. my code looks like this typedef struct { CString name; Cstring job; } Raghu; Raghu raghu; raghu.name = "Raghu"; raghu.job = "none"; COPYDATASTRUCT datastruct; datastruct.lpdata = (void*)&raghu; datastrcut.cbdata=raghu.name .getlength() + raghu.job.getlength();//is this correct way?? ::SendMessage(HWND_BROADCAST, WM_COPYDATA, (WPARAM)this->GetSafeHwnd(), (LPARAM)&datastruct); Thanks in advance
-
Hi All, I have a structure of CString variabls.I need to pass this variable from one application to other application.I was trying WM_COPYDATA message to pass the data but i'm unable to receive the structure in the destination process.can someone help me out in this. my code looks like this typedef struct { CString name; Cstring job; } Raghu; Raghu raghu; raghu.name = "Raghu"; raghu.job = "none"; COPYDATASTRUCT datastruct; datastruct.lpdata = (void*)&raghu; datastrcut.cbdata=raghu.name .getlength() + raghu.job.getlength();//is this correct way?? ::SendMessage(HWND_BROADCAST, WM_COPYDATA, (WPARAM)this->GetSafeHwnd(), (LPARAM)&datastruct); Thanks in advance
You can't pass pointers between process WM_COPYDTA designated for transfer easy weight data (no more than LONG) You can shared data among process use memory mapped files or use __declspec(allocate) see MSDN or "Ritcher Programming for Windows"
-
Hi All, I have a structure of CString variabls.I need to pass this variable from one application to other application.I was trying WM_COPYDATA message to pass the data but i'm unable to receive the structure in the destination process.can someone help me out in this. my code looks like this typedef struct { CString name; Cstring job; } Raghu; Raghu raghu; raghu.name = "Raghu"; raghu.job = "none"; COPYDATASTRUCT datastruct; datastruct.lpdata = (void*)&raghu; datastrcut.cbdata=raghu.name .getlength() + raghu.job.getlength();//is this correct way?? ::SendMessage(HWND_BROADCAST, WM_COPYDATA, (WPARAM)this->GetSafeHwnd(), (LPARAM)&datastruct); Thanks in advance
You can't used class with WM_COPYDATA. Only like this. typedef struct { char name[256]; char job[256]; } Raghu; Raghu raghu; strcpy(raghu.name, "Raghu"); strcpy(raghu.job, "none"); COPYDATASTRUCT datastruct; datastruct.lpdata = (void*)&raghu; datastrcut.cbdata=sizeof(raghu)? ::SendMessage(HWND_BROADCAST, WM_COPYDATA, (WPARAM)this->GetSafeHwnd(), (LPARAM)&datastruct); --------------------------- Auto Debug for Windows website: http://www.autodebug.com/
-
You can't used class with WM_COPYDATA. Only like this. typedef struct { char name[256]; char job[256]; } Raghu; Raghu raghu; strcpy(raghu.name, "Raghu"); strcpy(raghu.job, "none"); COPYDATASTRUCT datastruct; datastruct.lpdata = (void*)&raghu; datastrcut.cbdata=sizeof(raghu)? ::SendMessage(HWND_BROADCAST, WM_COPYDATA, (WPARAM)this->GetSafeHwnd(), (LPARAM)&datastruct); --------------------------- Auto Debug for Windows website: http://www.autodebug.com/
Hi, Thanks for the suggestion. The code works.but whenever i send this broad cast message microsoft outlook gives a message "The command line argument is not valid. Verify the switch you are using.". i tried giving different value to datastruct.dwData variable.but is of no use.can you please help me on this Regards Raghu
-
Hi, Thanks for the suggestion. The code works.but whenever i send this broad cast message microsoft outlook gives a message "The command line argument is not valid. Verify the switch you are using.". i tried giving different value to datastruct.dwData variable.but is of no use.can you please help me on this Regards Raghu