[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Listen a key without a focus on our application

Posted on 2011-02-21
4
Medium Priority
?
389 Views
Last Modified: 2012-05-11
Hi,

I've an application(C# 4.0-WPF), which is hidden and can be displayed by clicking on the systray icon or on an other frame I created(small frame which is docked left and topmost).

My customer wants to add a new way to display the application: When pressing on a "F" key(e.g. F9).

How can I do to know when I got this key stroke if my application hasn't the focus?

Thank you very much
0
Comment
Question by:Nargzul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 16

Expert Comment

by:sjklein42
ID: 34942344
To intercept hotkeys you need a background process.  There is a free (shareware) program that I use to do this on my systems.  You can do this without programming if you want to take this approach.

It is called "The Wonderful Icon".  This taskbar icon lets you define hotkeys to activate programs and do many other useful things.  I have used it for many years without any problems.

http://www.thewonderfulicon.com/download.html

As they say:


About The Wonderful Icon:

The Wonderful Icon 2.2 is a small Windows utility that resides in your PC's taskbar tray. Try it and you'll be hooked!

TWI has lots of wonderful features. With it, you can:

Assign hotkeys for common tasks such as minimize windows, restart Windows, etc.
Minimize programs onto the taskbar tray instead of just onto the taskbar, either by a keystroke or by right-clicking a window's Minimize button with your mouse
Configure a menu of easily-accessible commands
Increase or decrease speaker volume with the press of a button
Automatically run programs at start-up, and hide them, minimize them to the taskbar tray, etc.
Lots more!
Oh yeah, and it's free!

0
 
LVL 1

Author Comment

by:Nargzul
ID: 34942858
I can't do anything with that... I'm developing a c# application which is still running, I can't do this interacting with my software. And I need a code-c# solution sorry :/
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 1500 total points
ID: 34944374
You can either:
(1) Use the RegisterHotKey() API to register a specific hot-key combo and get notified when it gets pressed.
(2) Use a low level keyboard hook via WH_KEYBOARD_LL to listen to ALL keystrokes and intercept your specific combo.
0
 
LVL 1

Author Closing Comment

by:Nargzul
ID: 34977374
Thank you, but it's a pity that you didn't included a code ;)
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question