Solved

C# SendMessage string with WM_COPYDATA

Posted on 2004-08-28
8
7,438 Views
Last Modified: 2013-11-13
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..
0
Comment
Question by:c03dn
  • 4
  • 2
8 Comments
 
LVL 5

Expert Comment

by:rsriprac
ID: 11920565
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
 

Author Comment

by:c03dn
ID: 11920604
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
 
LVL 5

Expert Comment

by:rsriprac
ID: 11920626
How about the source from here:

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

-Ram
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:c03dn
ID: 11920652
That's c++.. for one, it's using CSTRING. I need a full c# sample with the dll imports and all.
0
 

Author Comment

by:c03dn
ID: 11920664
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
 

Author Comment

by:c03dn
ID: 11946431
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 12205451
PAQed, with points refunded (250)

GhostMod
Community Support Moderator
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to split this in C++ 4 102
Adding Namespace to the second node of the xml 16 73
Apps blocked by Java 9 79
C# application error "Parameter Is Not Valid". 3 94
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question