WinProc and Messages

  • Thread starter Thread starter Lav
  • Start date Start date
L

Lav

Hi,
I want my Win form to listen to keystroke even when it is minimized.
I think it can be done overriding the WinProc method.
But I didn't get any useful articles on how to go about it.
Can someone tell what would be the best way to do it ?

Thanks
Lav
 
// protected override void WndProc(ref System.Windows.Forms.Message m)
// {
// const int WM_LBUTTONDBLCLK = 0x203;
// switch(m.Msg )
// {
// case WM_LBUTTONDBLCLK:
// MessageBox.Show ("db click");
// return;
// break;
// }
// base.WndProc (ref m);
//
//
// }
 
Raj said:
// protected override void WndProc(ref System.Windows.Forms.Message m)
// {
// const int WM_LBUTTONDBLCLK = 0x203;
// switch(m.Msg )
// {
// case WM_LBUTTONDBLCLK:
// MessageBox.Show ("db click");
// return;
// break;
// }
// base.WndProc (ref m);
//
//
// }

:
Raj ,

Thanks for the response.
But the Msg property of the Message could be different for the same
key.
Actually my requirement is to make a Form visible (which by the way is
in notification bar)
once the user presses a key or set of keys.


- Lav
 
Lav said:
Hi,
I want my Win form to listen to keystroke even when it is minimized.
I think it can be done overriding the WinProc method.
But I didn't get any useful articles on how to go about it.
Can someone tell what would be the best way to do it ?

Thanks
Lav

Hi Lav,
I think it can be done overriding the WinProc method.

I'm afraid nothing so simple... if your window doesn't have the focus,
you're not going to get any key events, unless you wire in a windows hook.

Take a look at this article:
<UrlMightWrap>
http://www.codeproject.com/csharp/globalhook.asp
</UrlMightWrap>

This may be what you need.

Hope this helps,
-- Tom Spink
 

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

Back
Top