Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 890
  • Last Modified:

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

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
endrec
Asked:
endrec
1 Solution
 
MisbahCommented:
0
 
Epitel0920Commented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now