Solved

Listen a key without a focus on our application

Posted on 2011-02-21
4
381 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
  • 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 85

Accepted Solution

by:
Mike Tomlinson earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

929 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now