Jump to content

HotKeySet, RegisterHotkey


Recommended Posts

#include <GUIConstants.au3>

; Here's an awesome list of virtual key codes -> http://delphi.about.com/od/objectpascalide/l/blvkc.htm

$MOD_ALT = 0x0001
$MOD_CONTROL = 0x0002
$MOD_SHIFT = 0x0004
$MOD_WIN = 0x0008

$hWnd = GUICreate("Nothing", 100, 100)
GUIRegisterMsg(0x0312, "MY_WM_HOTKEY") ; WM_HOTKEY

For $i = 0x30 To 0x5A
    DllCall("user32.dll", "short", "RegisterHotKey", "hwnd", $hWnd, "int", "1337" & Dec($i) , "uint", $MOD_SHIFT, "uint", $i)
Next
For $i = 0x30 To 0x5A
    DllCall("user32.dll", "short", "RegisterHotKey", "hwnd", $hWnd, "int", "1338" & Dec($i) , "uint", 0, "uint", $i)
Next

While 1
    Sleep(100)
WEnd

Func MY_WM_HOTKEY($hWnd, $Msg, $wParam, $lParam)
    $n = Chr(Dec(StringMid($lParam,5,2)))
    $caps = StringRight($lParam,1)
    If $caps = "4" Then
        $n = "+" & StringLower($n)
    EndIf
    MsgBox(0, "", "You pressed " & $n )
EndFunc

A tribute to Larry.

Edited by Manadar
Link to comment
Share on other sites

This would be new if there was no HotKeySet.

Yeah, but you can unset this.

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

You can unset HotKeySet too.

HotKeySet( "{ENTER}", "SomeFunction" ) ;Set the hotkey


HotKeySet( "{ENTER}" ) ;Unset the hotkey
Ah. Right.

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...