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
875 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

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

896 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

14 Experts available now in Live!

Get 1:1 Help Now