Solved

Listen a key without a focus on our application

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

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

695 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