-
December 20th, 2012, 04:21 AM
#1
How to send a windows message from C# to C++ (MFC)?
Hello mates,
I'm trying to send a windowsmessage from an app in C# (Compact Frame) to another one in C++ (MFC), both of them in a PDA.
In the receiver app (MFC) I realize that I receive the message but I can't read the string message, it shows a little square.
This is the code of the Sender (C#)
Code:
OpenNETCF.Win32.Win32Window.SendMessage(hwndVal, typeMsgVal, intValue, stringMessage);
And this is the code of the receiver (C++)
Code:
CString myStr = (CString) lParam;
AfxMessageBox(myStr);
Thanks a lot in advance!
-
December 20th, 2012, 01:37 PM
#2
Re: How to send a windows message from C# to C++ (MFC)?
You just cannot pass a striing between the processes with a message. So you need to try with some other way of interprocess communication.
Best regards,
Igor
-
December 21st, 2012, 05:16 AM
#3
Re: How to send a windows message from C# to C++ (MFC)?
Could i pass a byte[] from c# to c++?
-
December 21st, 2012, 02:21 PM
#4
Re: How to send a windows message from C# to C++ (MFC)?
Originally Posted by CarlosEveris
Could i pass a byte[] from c# to c++?
You can't pass pointers between two processes. Like Igor said a string pointer from one process will mean nothing in another process (and will most likely point to an invalid memory location).
This concept is more fundamental to processes in general and isn't a C# to C++ thing.
Search bing or google for "interprocess communication techniques" for more info on passing data from one process to another.
-
December 22nd, 2012, 01:42 AM
#5
Re: How to send a windows message from C# to C++ (MFC)?
Originally Posted by CarlosEveris
Could i pass a byte[] from c# to c++?
Of course you can. But not with a message.
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|