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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

792 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