How to handle Windows message in Form.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am writing C# application for Windows Mobile 5.0. How can I handle windows
message for System.Windows.Forms.Form of my application. overriddable
protected WndProc is not supported in Windows Mobile 5.0. Is there any
alternate to handle windows message in form.
Thanks in advance
 
I am getting error when trying to override WndProc method...
error CS0115: 'WndProc(ref Message m)': no suitable method found to override
Also in MSDN Mobile icon is not shown for this method.
 
Thanks, MessageWindow creates a separate message sink with a new HWND.
Messages sent to the main window of the application
(System.Windows.Forms.Form) are not recieved by this message window.
I am trying to send message from a C++ application to the main window of the
application, for that I am searching the main application window hwnd using
EnumWindows and sending a custom message using SendMessage API. This message
is sent to the applicaion main window (not the MessageWindow created within
the application. this has a different hwnd and message sink).
I am looking for a way where I can handle the windows message of the Main
Application window (System.Windows.Forms.Form) and not the separate message
sink created within the application.

When I tried to use Text property of MessageWindow class to give it a name
so that I can search this and send message to this message sink. I am not
able to assign any value to messagewindow's Text property.
 
Unfortunately IMessageFilter is not supported by .net compact framework 2.0.
Finally I got it done using RegisterWindowMessage to get the system level
unique message and broadcasting that message from C++ application by
SendMessage(HWND_BROADCAST , ..... and handling the same in my WindowMessage
derived message sink in C# application.
Thanks
- Jaikant
 
Back
Top