Link to home
Start Free TrialLog in
Avatar of locdang
locdang

asked on

Detect WinKey+1 then bring application into foreground

Hi,

I want to be able to make my application come into the foreground when the user presses WinKey+1

Is anyone able to assist me? I can find plenty of ways of detecting key presses within the application, but not when other applications may be in the foreground.

Thanks,

Xavier.
SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
For simplicity sake I'll post this solution.  I admit it is not nearly as robust as Idle_Mind's solution, but, if you are just looking for a quick and dirty way of accomplishing the same thing here is some code I used in a demo once.  Note: It should not be used in systems that run 24/7 unless you handle the buffer size.


'For keydown event subroutine
keydownBuffer += " " & e.KeyValue.ToString
 
If keydownBuffer.Length >= 7 Then
Dim myTarget As String = keydownBuffer.ToString.Substring(keydownBuffer.Length -7, 7) ' isolate the last key combination entered
If myTarget = " 16 112" Then '" 16 112" is Shift+F1
'do stuff
End If
End If

Open in new window

It looks like that would only work when the Form already has focus sl8rz...

I think the author wants his app to pop up when his combo is pressed ANYTIME (when other apps and/or the desktop has focus).
>> but not when other applications may be in the foreground.

That's also my guess!
Yes...right you are Idle, my bad.