Windows Messages....

  • Thread starter Thread starter GTi
  • Start date Start date
G

GTi

I need to get access to the Windows Messages queue (WM_xxx)
I have a old C application that sends some messages to all windows
on the computer. How can my new C# application receive this message?
 
GTi,

In your main form, you can override the WndProc method and it will be
called whenever it receives a message from the loop. However, you have to
make sure you call the base implementation to WndProc so that other messages
get processed as well.

Hope this helps.
 
From which "window" (aka Form, Control, etc in .NET WinForms)?

If it's just the form in general, in your WhateverForm.cs class, override
the WndProc or DefWndProc method as appropriate.

There's also an "OnNotifyMessage" method that you should use, instead, if
you're dealing with notify messages.

If it's a control (like a button or listbox or something), then you'll have
to create your own class that derrives from that class (Button, ListBox,
etc) and override the WndProc method as necessary.

-c
 
Thanks all...
But I wonder what is most cost effective:
(if it matter)
Using: WndProc or OnNotifyMessage
 
Back
Top