wndproc in c#

Started by
13 comments, last by steg 20 years, 9 months ago
I''m getting fed up with this now, I still cannot convert the WParam to a string. I really thought the code below would work :

string str = System.Runtime.InteropServices.Marshal.PtrToStringAuto( msg.WParam );

But just get a load of null characters ?

Has anybody converted WParam to a string, I know that we are passing a string into the WParam from our C++ application, surely you can pass more than integers into the WParam and LParam ?

Anybody any more ideas ?

Kind regards,
Steve

If it isn't working, take a bath, have a think and try again...

Advertisement
You could try writing a C++ managed unsafe function to read it, and calling it from your C# program. At least, you'd be sure that the message is indeed there.
EDIT: Sorry, I just realized that you had done this in C# already. In fact, now that I look at my first post, sorry for posting at all.

[edited by - cedricl on July 6, 2003 1:42:26 PM]
It seems like the problem is that the string is in a seperate application''s address space, and *that* is why you can''t get to it.

So, why are you passing strings? If you know what types of information you are going to be getting, why not just pass int''s around?
Michael Russell / QA Manager, Ritual EntertainmentI used to play SimCity on a 1:1 scale.
quote:Original post by RomSteady
It seems like the problem is that the string is in a seperate application''s address space, and *that* is why you can''t get to it.

I concur. You might want to try this:
quote:
WM_COPYDATA Message

--------------------------------------------------------------------------------

An application sends the WM_COPYDATA message to pass data to another application.


Cédric
Thanks all,

RomSteady - I guess you could be correct, reason passing strings is that the strings contain visual text information to be displayed.

Cedricl - will try the copy data method.

Kind regards,
Steve

If it isn't working, take a bath, have a think and try again...

This topic is closed to new replies.

Advertisement