I have build an application using the SendMessageTimeout function with
WM_COPYDATA. This will work fine, but one costumer tells me that he get
the error code 87 (invalid parameter) in most of all calls of this
function. My problem is to have no more information about this error and
I can't go to that costumer to check the system ...
Here the program fragment, I use:
static CmdLineType CmdLine;
void function (void) {
COPYDATASTRUCT Data;
DWORD result;
HWND hwnd; // handle of the
receiving window
HWND HWindow; // handle of the
sending window
...
Data.dwData = 0;
Data.cbData = sizeof (CmdLineType);
Data.lpData = &CmdLine;
if (!SendMessageTimeout (hwnd, WM_COPYDATA, (WPARAM)HWindow,
(LPARAM)&Data, SMTO_NORMAL, 3000, &result)) {
ErrLog (GetLastError ()); PostQuitMessage (1); return;}
....
}
Is there a possibility to find out, what parameter is invalid or what
can be the reason of that error.
Thanks a lot,
Peter
You need (if CmdLineType is LPCTSTR, else you might need to change _tcslen
to strlen or wcslen):
Data.dwData = 0;
Data.cbData = (_tcslen(CmdLine)+1) * sizeof(CmdLine[0]);
Data.lpData = &CmdLine;
...
Christian
Peter Klinge <AME...@t-online.de> wrote in message
news:398EC1F7...@t-online.de...
Peter