How to send a windows message from C# to C++ (MFC)?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: How to send a windows message from C# to C++ (MFC)?

Hybrid View

  1. #1
    Join Date
    Dec 2012
    Posts
    2

    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!

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,070

    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

  3. #3
    Join Date
    Dec 2012
    Posts
    2

    Re: How to send a windows message from C# to C++ (MFC)?

    Could i pass a byte[] from c# to c++?

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,480

    Re: How to send a windows message from C# to C++ (MFC)?

    Quote Originally Posted by CarlosEveris View Post
    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.

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,070

    Re: How to send a windows message from C# to C++ (MFC)?

    Quote Originally Posted by CarlosEveris View Post
    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center