Re: trapping F1 in a file dialog
-
Hello, I'm using C# in Visual Studio 2008. Is it possible to trap the F1 key in a file dialog (Open or 'Save As')? I've been searching on the internet for the answer to this but I've found none. Any help is appreciated. Regards, Mike
-
Although I have never done this, my first thought is GetActiveWindow + Global keyboard hook.
-
d@nish, I'm not sure about the GetActiveWindow, but I found a global keyboard hook program. Everything appears to be working now. Thank you for your help. Regards, Mike
Really? You might want to see what happens in your app while its running and the user switches to another app and hits F1.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009... -
Really? You might want to see what happens in your app while its running and the user switches to another app and hits F1.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009... -
d@nish, I'm not sure about the GetActiveWindow, but I found a global keyboard hook program. Everything appears to be working now. Thank you for your help. Regards, Mike
It is "global keyboard hook". That will work regardless of the active window. So, if you have a notepad and your application running, and user presses F1 in the notepad, still the code in your application will fire. That is why I said GetActiveWindow + global keyboard hook. You should check in which window is that F1 key pressed and then process it.
-
Dave, What happened when you did this? Regards, Mike -- Modified Tuesday, June 15, 2010 11:45 AM
Remember, that's a GLOBAL keyboard hook, that means SYSTEM GLOBAL, not application. If the users hits that key, while your app is running, in ANY application or Explorer window, it'll fire in your application. Is that what you want it to do??
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009...