RegisterHotKey and ShowInTaskbar

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I have a C# Windows Form program. I've used platform interop to call
RegisterHotKey and then check for it in an overrided WndProc. This
appears to be a standard approach and works, except...

when I set Form.ShowInTaskbar = false. The WM_HOTKEY messages stop
showing up in the WndProc. Is this a known problem?
 
I wrote a program that uses RegisterHotKey() and the main form has
ShowInTaskbar = false, but it's working for me. I have a notify icon in the
tray area, so maybe that's why.
 
Ok, I figured it out. You have to register the hotkey AFTER you set the
ShowInTaskbar state. Converserly, if you later toggle the ShowInTaskbar
state, you need to reregister the hotkey. Something about changing the
ShowInTaskbar state disables the hotkey.
 
Back
Top