Assembly: Microsoft.WindowsCE.Forms (in microsoft.windowsce.forms.dll)
The MessageWindow class provides the ability to send and receive Windows-based messages. It creates a Window handle in native code and performs the required platform invoke calls to native Windows functions.
To use the MessageWindow in your program you need to create a class derived from MessageWindow and override the default WndProc behavior to watch for specific Window messages. You can generate messages with the Message class. You can receive only the Windows-based messages that you generate using MessageWindow or those with a native control.
To use this class, you must add a reference in your Visual Studio 2005 project to the Microsoft.WindowsCE.Forms namespace.
The following code example demonstrates MessageWindow by having the form send Windows-based messages of current mouse x-y coordinates to the message window, which invokes the callback method on the form to display the coordinates in the title bar.
The form contains a custom class, MsgWindow, derived from MessageWindow. The MsgWindow class examines messages in the overridden WndProc method, looking for messages with a WM_CUSTOMMSG identifier. When it finds these messages, it invokes the RespondToMessage callback method defined in the form.
The form creates a new instance of MsgWindow. The MsgWindow constructor takes a form, which in this example is the containing form. The form generates Windows-based messages in an override of the OnMouseMove method.
When the form runs, mouse movements generate messages to the message window. The message window WndProc method invokes the callback method on the form, which responds to the messages.
Note that you must add a reference to Microsoft.WindowsCE.Forms to your project.