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..
c03dnAsked:
Who is Participating?
 
GhostModConnect With a Mentor Commented:
PAQed, with points refunded (250)

GhostMod
Community Support Moderator
0
 
rsripracCommented:
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
0
 
c03dnAuthor Commented:
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.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
rsripracCommented:
How about the source from here:

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

-Ram
0
 
c03dnAuthor Commented:
That's c++.. for one, it's using CSTRING. I need a full c# sample with the dll imports and all.
0
 
c03dnAuthor Commented:
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?
0
 
c03dnAuthor Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.