Solved

Listen a key without a focus on our application

Posted on 2011-02-21
4
380 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

22 Experts available now in Live!

Get 1:1 Help Now