Biast to WM_COPYDATA

  • Thread starter Thread starter nak
  • Start date Start date
N

nak

Hi there,

I'm trying to send messages to and from applications written in VB.NET,
I wish to do this by sending windows messages. Though I have come across a
problem, I wish to be able to send my own custom packets in the form of a
string in the lParam parameter but can only seem to do this if the message
ID is WM_COPYDATA.

What I want to be able to do is send strings in the lParam parameter but
with my own message ID, i.e. WM_NAKMSG as I want to be able to keep my
application control protocol completely separate of any Windows handling.

Can anyone offer advice on this? Or do I *have* to use WM_COPYDATA? It
seems a little blind to have to do this, when I try using my own ID the
structures data gets reset for some reason or another, I presume this is
down to some background message handling that I am not aware of. I thought
the point of sending your own messages was that you could send whatever you
wanted in them without interfering with the internals.

Anyway, I look forward to a reply, thanks in advance!

Nick.
 
Hi there,

I'm trying to send messages to and from applications written in VB.NET,
I wish to do this by sending windows messages. Though I have come across a
problem, I wish to be able to send my own custom packets in the form of a
string in the lParam parameter but can only seem to do this if the message
ID is WM_COPYDATA.

What I want to be able to do is send strings in the lParam parameter but
with my own message ID, i.e. WM_NAKMSG as I want to be able to keep my
application control protocol completely separate of any Windows handling.

Can anyone offer advice on this? Or do I *have* to use WM_COPYDATA? It
seems a little blind to have to do this, when I try using my own ID the
structures data gets reset for some reason or another, I presume this is
down to some background message handling that I am not aware of. I thought
the point of sending your own messages was that you could send whatever you
wanted in them without interfering with the internals.

Anyway, I look forward to a reply, thanks in advance!

Nick.

Nick....

If you must do this with Window Messages, do your self a favor and just
use WM_COPYDATA. Using a custom message for passing data across process
boundries is a BAD idea. See, the problem is that to send custom
messages across processes, you need to create the message with
RegisterWindowMessage. Windows will not marshal pointers accross
process boundries for you.

You may want to consider using another means of interprocess
communication, specifically since you indicate that these are VB.NET
apps - you may want to look into remoting to pass your data back and
forth.
 
Hi Nick,

In addtion to Tom's reply, you can also use Memory mapping file to do data
sharing between different process in .Net.

For more information, please refer to:
"DevGlobalCache ¨C A way to Cache and Share data between processes"
http://www.codeproject.com/dotnet/globalcache.asp

Hope it helps,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi nak,

Does our reply make sense to you? Do you still have any concern?

Please feel free to feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top