c03dn
asked on
C# SendMessage string with WM_COPYDATA
I need a code example of a working SendMessage api call in C# which sends a string, and also a WndProc example of how it is received and turned into a string again. Im tired of fighting this. Also, how to send a simple integer would also be a plus..
ASKER
WM_COPYDATA would be used in with SendMessage, as it would have been the actual message code. None of the sites really made me wiser, I need a code example.. both send and receive.
ASKER
That's c++.. for one, it's using CSTRING. I need a full c# sample with the dll imports and all.
ASKER
I can't even send a simple integer. Even though my lparam parameter in SendMessage is int, the message received has an IntPtr. How do I get the integer value? .toInt32() doesn't give me the right value. I am guessing it is a pointer to a memory adress, and how do I work with that? Do I need to use unsafe?
ASKER
I found a suitable solution at:
http://www.mail-archive.com/dotnet@discuss.develop.com/msg01837.html
http://www.mail-archive.com/dotnet@discuss.develop.com/msg01837.html
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Have you seen this post?
http://www.dotnet247.com/247reference/msgs/43/217002.aspx
They suggest to pass strings via WM_COPYDATA and not use SendMessage for string. Heres to decoding:
http://www.dotnet247.com/247reference/msgs/7/35565.aspx
-Ram