0

Say I have started application on Windows (created in WPF for .NET in case that would help), that opens some windows/panels and just runs in a background. User don't want to interact with it constantly, however once in a while needs to urgently execute some actions in it.

Is it possible to bind some key shortcut e.g. alt+key to running application, so on hitting it app gets focus? It doesn't necessarily need to be brought to front, altough that would be nice as well.

Kranach
  • 740
  • 2
  • 9
  • 24
  • Is ["Bring a window to the front in WPF"](http://stackoverflow.com/q/257587/352101) what you are after? – Bolu May 23 '14 at 15:45
  • Would this be a security concern? Since the shortcut keys on someone's machine are a property of their local windows account ... not sure this something you would be allowed to set (not without user confirmation at least). That said: what about a group policy on the groups/user accounts in the domain within which your application is running? – Aidanapword May 23 '14 at 16:05
  • Yeah, more or less. So I'm guessing short answer is "no"? – Kranach May 23 '14 at 16:05
  • @Aidanapword security shouldn't be a concern since this is just for inside use. If there is way to do this user would be more than happy to cooperate with achieving this. – Kranach May 23 '14 at 16:07
  • What I mean is: Windows as an operating system will probably not allow this (that is: a program changing a User's settings -> although if it is running "As Administrator" there might be) ... – Aidanapword May 23 '14 at 16:14
  • 1
    Just found: [Win32 API RegisterHotKey function](http://msdn.microsoft.com/en-us/library/ms646309%28VS.85%29.aspx) which might work for you ... though how you would deal with the fact that this API call will likely fail unless you are running as an administrator ...? – Aidanapword May 23 '14 at 16:15
  • No idea, maybe it will just work :) – Kranach May 23 '14 at 16:20

2 Answers2

0

"a hotkey that works out of your application" is this what you want? if so, you need global hotkey that i can reference to! (Sorry i didn't have enough reputation for commenting!)

ACE
  • 379
  • 3
  • 12
0

I think I found sort of semi-solution, that doesn't need any coding or changing any system settings, but only:

1) keyboard with Windows key

2) possibly forcing user to re-arrange icons on his task bar (or pin my application as one of first 9 applications on his taskbar)

pressing WinKey+digit brings up digit'th application from the taskbar. Pressing it again hides it.

This works for Windows 7.

Obiously doing this way is a bit lame and not customizable at all, but it's always something... Still happy to find better way if there exists such.

Kranach
  • 740
  • 2
  • 9
  • 24