Solved

C# SendMessage string with WM_COPYDATA

Posted on 2004-08-28
8
7,387 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
Comment Utility
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
Comment Utility
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
Comment Utility
How about the source from here:

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

-Ram
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:c03dn
Comment Utility
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
Comment Utility
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
Comment Utility
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
Comment Utility
PAQed, with points refunded (250)

GhostMod
Community Support Moderator
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now