Jump to content

GuiHotKey UDF


Recommended Posts



This is a very small but useful UDF library for support native API HotKey controls. This library is written similary as other AutoIt GUI libraries. For more information, see detailed descriptions of all functions inside GuiHotKey.au3.

If you need more capacity to work with hot keys, you can use >HotKey UDF and >HotKeyInput UDF libraries.


Available functions








HotKey UDF Library v1.0

Previous downloads: 117



#include <GUIConstantsEx.au3>
#include <GUIHotKey.au3>

Global $HK, $VK

$hForm = GUICreate("MyGUI", 300, 92)
$hHotKey = _GUICtrlHotKey_Create($hForm, _GUICtrlHotKey_MakeKeyCode($HOTKEYF_ALT, $VK_F5), 20, 20, 260, 19)
$Button = GUICtrlCreateButton('OK', 115, 54, 70, 23)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
        Case $Button
            $Code = _GUICtrlHotKey_GetHotKey($hHotKey)
            _GUICtrlHotKey_GetKeys($Code, $HK, $VK)
            MsgBox(64, "Info", "Hot key code:" & @TAB & "0x" & Hex($Code, 4) & @CR & "Key modifier flags:" & @TAB & "0x" & Hex($HK, 2) & @CR & "Virtual key code:" & @TAB & "0x" & Hex($VK, 2), 0, $hForm)
Edited by Yashied
Link to comment
Share on other sites

I did the same thing last year. I just got mine out to test though and there are a few bugs, so I'll probably be using yours from now on :unsure:

The one thing I did like about mine was that it autoit hotkey strings rather than virtual keys. Saves a lot of hassle. All I need to do is fix mine so that using letters means lower case letter output unless shift is pressed (like autoit does).

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...
  • 1 year later...

Hi :)

Very nice UDF ! Thanks a lot ! It was really helpfull !

BTW, when I try to use it with the function "_IsPressed" it works with every HotKey like "A, B, C, F12, F5, etc..." but it doesn't work with CTRL + F2 or ALT + F1

If _IsPressed(Hex($Code, 4))

There is another way to do this?

Thank ! :)

Link to comment
Share on other sites

  • 11 months later...
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

  • Recently Browsing   0 members

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