Thanks!
You saved a me a couple of hours there!
You are welcome! Keep in your mind that
this will work for other controls as well!
Hooking is only indicated in scenarios when
..NET Events do not cover that area, and even
then you have the WndProc to handle and if
this isnt enough, then you can use global
hooks,...
If you wanna see what global hooks can do
for you, have a look at one of my applications:
http://www.pro-it-education.de/software/deviceremover
Its a powerful and very verbose device manager for windows.
Install and run it, then enter in the lower command text box
"privdlg on" to enable the securty dialog on low-level operations.
Now try to disable, enable, eject, etc. on one device or service/driver.
You will get the extra security dialog, that hooks the windows key,
control+Esc, etc,... Control+Alt+Del is still allowed for security reasons,
though the kernel level driver could filter even this out, but this is very
advanced stuff and has absolutely nothing to do with C# anymore!
Thats what Low-Level Hooks can do for you: A complete hook into the
Systems Keyboard to filter (or modify) out anything you want,
"privdlg off" will remove the hook from the application,...
Here are some examples if you are interested:
[Low-Level Mouse Hook in C#]
http://blogs.msdn.com/toub/archive/2006/05/03/589468.aspx
[A Simple C# Global Low Level Keyboard Hook]
http://www.codeproject.com/KB/cs/CSLLKeyboardHook.aspx
Have fun!
Regards
Kerem