How do I catch windows messages in C#??

How do I catch windows messages in C#??

In MFC, I would do this:

// to catch windows messages
MSG msg;
while( PeekMessage( &msg,NULL,0,0,PM_REMOVE ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}

Thanks.



Comments

  • protected override void WndProc(ref Message m) {
    //switch m.WParam etc...
    base.WndProc(ref m);
    }

    shove that into your form. you'll need to declare all the WM_COMMAND etc messages with const ints.

    ------------------------------------------
    The art of war is not to die for your country, but to make the other bastard die for his!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion