How can i process windowmessages in .net ?

  • Thread starter Thread starter dulo
  • Start date Start date
D

dulo

I want to prevent a window from becoming active in some situations ( for
my multiwindow ( docking ) application. I want to mimic the behaviour of
devdstudio2003. If you click into the menubar of the mainwindow if an
undocked window is active mainwin does not get active.

I got a tip to handle
WM_MOUSEACTIVATE and returning MA_NOACTIVATE. Then it posts
WM_LBUTTONDOWN and WM_LBUTTONUP messages to itself to simulate that a
click took place.
But how can i do that in .net ?
The WndProc Message in .net does not have a returnvalue.

thx Dulo
 
Hi

You can use common Win APIs. PInvoke allows managed application to run
unmanged code. Offcoures, it's not the fastest way... But it will work.
 
Hi,

You can override WndPrc like this

protected override void WndProc(ref Message m)
{
if (m.Msg == WM_MOUSEACTIVATE)
{
// Do your stuff
}

base.WndProc (ref m);
}

remember always to keep the base call, otherwise no messages will be
processed!

Cheers
 
Try also look at the IMessageFilter Interface which you can make your
form implement. This interface allows you to receive and filter
messages before they are dispatched to a control or form.

Regards

Stig Nielsson
Marstrand Innovation
Copenhagen, Denmark.
 
Back
Top