Link to home
Start Free TrialLog in
Avatar of c03dn
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..
Avatar of rsriprac
rsriprac

Hello,

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
Avatar of c03dn

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.
How about the source from here:

http://www.codeproject.com/threads/ipc_wmcopy.asp

-Ram
Avatar of c03dn

ASKER

That's c++.. for one, it's using CSTRING. I need a full c# sample with the dll imports and all.
Avatar of c03dn

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 CERTIFIED SOLUTION
Avatar of GhostMod
GhostMod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial