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!
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.
Re: How to send a windows message from C# to C++ (MFC)?
Could i pass a byte[] from c# to c++?
Re: How to send a windows message from C# to C++ (MFC)?
Quote:
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.
Re: How to send a windows message from C# to C++ (MFC)?
Quote:
Originally Posted by
CarlosEveris
Could i pass a byte[] from c# to c++?
Of course you can. But not with a message.