Jump to content
Sign in to follow this  
jvanegmond

HotKeySet, RegisterHotkey

Recommended Posts

jvanegmond

#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

Share this post


Link to post
Share on other sites
Skrip

Very nice. Works great.


[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]

Share this post


Link to post
Share on other sites
Siao

This would be new if there was no HotKeySet.


"be smart, drink your wine"

Share this post


Link to post
Share on other sites
Skrip

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]

Share this post


Link to post
Share on other sites
Vicis

Yeah, but you can unset this.

You can unset HotKeySet too.

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


HotKeySet( "{ENTER}" ) ;Unset the hotkey

Share this post


Link to post
Share on other sites
Skrip

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]

Share this post


Link to post
Share on other sites
jvanegmond

This would be new if there was no HotKeySet.

Shut up fool.

HotKeySet has a limit of 64 hotkeys, which is annoying.

Share this post


Link to post
Share on other sites
SkinnyWhiteGuy

Not to cause more of a problem, but...

Beta Topic (Beta Inclusion)

Changelog (look for the 3.2.4.0 Entry)

Share this post


Link to post
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
Sign in to follow this  

×