Solved

How to create global hotkeys that intercept commands like Ctrl+F1 in an application that runs in the tray?

Posted on 2010-11-12
2
874 Views
Last Modified: 2013-12-17
Hi,
I wanted to find out if there is a way to set up global hotkeys for a .NET application that runs in the background/is in the system tray.  Basically what I am looking to do is allow an application to do things with hotkeys while it may not be the "active" open application.

Example: User presses [Ctrl]+[Print Scrn] then instead of the normal Windows print screen command running the application that is running in the tray should be able to perform an action based on that.
0
Comment
Question by:endrec
2 Comments
 
LVL 9

Accepted Solution

by:
Misbah earned 500 total points
ID: 34123928
0
 
LVL 3

Expert Comment

by:Epitel0920
ID: 34124604
Another idea on asp page:
var CTRL = 0;
var KEYCODE;

document.onkeydown = KeyDownHandler;
document.onkeyup = KeyUpHandler;
function KeyDownHandler(e) {
   var evnt = window.event;
    var x = evnt.keyCode;
    if (x == <key code for CTRL>)
        CTRL = 1;
    KEYCODE = x;
}

function keyuphandler(e)
{
if (KEYCODE == <key for F12> and CTRL == 1)
   {
        //Keycode = -1 CTRL = 0;
       //you print statement
   }
}
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

19 Experts available now in Live!

Get 1:1 Help Now