How can i process windowmessages in .net ?

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
 
G

Guest

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.
 
G

Guest

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
 
S

Stig

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top