Home > Net > Interprocess communication, WM_COPYDATA, why SendMessage are returns 0 after sending?
Interprocess communication, WM_COPYDATA, why SendMessage are returns 0 after sending?
Time:09-22
Fellow teachers, ask a problem of the communication thread (c #, and between the WM_COPYDATA way, can already normal send and receive data)
1, why called SendMessage sent are the returns 0, are all failed! But the official document description: (If the identifiers application the processes this message, it should return TRUE; Otherwise, it should return FALSE.)
2, send SendMessage function is blocking way, close the receiving process again to send, also didn't see stuck phenomenon (such as didn't see transmitter reply situation)? (Sends the specified message to a window or Windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.)
3, the receiver is through what way to tell the sender "I have normal take data?" Read the lParam?
In a word, software that want to know: the success of the sender to send data
Supplement: try to use c + + console to send, also returns 0 (the other party has received data)
CodePudding user response:
Marshal. GetLastWin32Error ();
Specific error code can see https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes Such as 1400 errors for Invalid Handle,
If you control the receiver, also can return to a particular code 1,
BTW, using Windows messages do extensibility of communication between processes is very poor, now it is not recommended to do,