Solved

C# SendMessage string with WM_COPYDATA

Posted on 2004-08-28
8
7,584 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Six Sigma Control Plans
Progress

696 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