Yashied Posted March 2, 2009 Share Posted March 2, 2009 (edited) LAST VERSION - 1.328-Oct-11The library allows to create HotKey Input control by using the low-level keyboard hook. This UDF is designed specially to support the >HotKey UDF library but it can be used separately. Please look at the example below to understand how it works. For more information, see detailed descriptions of all functions inside the library.Available functions_GUICtrlHKI_Create_GUICtrlHKI_Destroy_GUICtrlHKI_GetHotKey_GUICtrlHKI_SetHotKey_GUICtrlHKI_Release_KeyLock_KeyUnlock_KeyLoadName_KeyToStrHotKeyInput UDF Library v1.3Previous downloads: 2564HotKeyInput.au3Example#Include <GUIConstantsEx.au3> #Include <HotKeyInput.au3> Global $Form, $HKI1, $HKI2, $Button, $Text $Form = GUICreate('Test', 300, 160) GUISetFont(8.5, 400, 0, 'Tahoma', $Form) $HKI1 = _GUICtrlHKI_Create(0, 56, 55, 230, 20) $HKI2 = _GUICtrlHKI_Create(0, 56, 89, 230, 20) ; Lock CTRL-ALT-DEL for Hotkey Input control, but not for Windows _KeyLock(0x062E) GUICtrlCreateLabel('Hotkey1:', 10, 58, 44, 14) GUICtrlCreateLabel('Hotkey2:', 10, 92, 44, 14) GUICtrlCreateLabel('Click on Input box and hold a combination of keys.' & @CR & 'Press OK to view the code.', 10, 10, 280, 28) $Button = GUICtrlCreateButton('OK', 110, 124, 80, 23) GUICtrlSetState(-1, BitOR($GUI_DEFBUTTON, $GUI_FOCUS)) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button $Text = 'Hotkey1: 0x' & StringRight(Hex(_GUICtrlHKI_GetHotKey($HKI1)), 4) & ' (' & GUICtrlRead($HKI1) & ')' & @CR & @CR & _ 'Hotkey2: 0x' & StringRight(Hex(_GUICtrlHKI_GetHotKey($HKI2)), 4) & ' (' & GUICtrlRead($HKI2) & ')' MsgBox(0, 'Code', $Text, 0, $Form) EndSwitch WEnd Edited February 6, 2014 by Yashied LukeLe, PlayHD and valdemar1977 2 1 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Izebize Posted March 10, 2009 Share Posted March 10, 2009 (edited) Very nice, but I noticed a little 'bug'. If you run the example, and you press "CTRL + ALT + SHIFT" (CAS) and then "D" key, it writes "CAS - D". It works as it is supposed to. But if you press CAS+D, release D and A, and again press D it writes "CAS - D", but you didn't pressed A. Same with S. Cheers! Edited March 10, 2009 by Izebize Link to comment Share on other sites More sharing options...
Yashied Posted March 11, 2009 Author Share Posted March 11, 2009 Very nice, but I noticed a little 'bug'.If you run the example, and you press "CTRL + ALT + SHIFT" (CAS) and then "D" key, it writes "CAS - D". It works as it is supposed to.But if you press CAS+D, release D and A, and again press D it writes "CAS - D", but you didn't pressed A. Same with S.Cheers!Thank you for your reply.This is not a bug. HotKey combination fixed after pressing function key ("D"). To clear it is necessary to release all the keys have been pressed ("CAS"). I did it for safe use. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Yashied Posted April 6, 2009 Author Share Posted April 6, 2009 This library has been updated. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Skizmata Posted April 27, 2009 Share Posted April 27, 2009 Great work Yashied I have learned allot from reading this script. Thanks, AutoIt changed my life. Link to comment Share on other sites More sharing options...
Yashied Posted April 28, 2009 Author Share Posted April 28, 2009 Great work Yashied I have learned allot from reading this script. Thanks,Thanks. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
JackDinn Posted May 24, 2009 Share Posted May 24, 2009 (edited) i cant figure out how to then set a hotkey after gathering the user input ? tried :- $x=_GUICtrlReadHotKeyInput($HotkeyInput1) HotKeySet($x,"test") also $x=Hex(_GUICtrlReadHotKeyInput($HotkeyInput1)) HotKeySet($x,"test") also $x='0x' & StringRight(Hex(_GUICtrlReadHotKeyInput($HotkeyInput1)), 4) HotKeySet($x,"test") sorry for my lack of understanding of what _GUICtrlReadHotKeyInput($HotkeyInput1) returns and how to use it. Edited May 24, 2009 by JackDinn Thx all,Jack Dinn. Â JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
Yashied Posted May 24, 2009 Author Share Posted May 24, 2009 (edited) i cant figure out how to then set a hotkey after gathering the user input ? tried :- $x=_GUICtrlReadHotKeyInput($HotkeyInput1) HotKeySet($x,"test") also $x=Hex(_GUICtrlReadHotKeyInput($HotkeyInput1)) HotKeySet($x,"test") also $x='0x' & StringRight(Hex(_GUICtrlReadHotKeyInput($HotkeyInput1)), 4) HotKeySet($x,"test") sorry for my lack of understanding of what _GUICtrlReadHotKeyInput($HotkeyInput1) returns and how to use it.Use HotKey.au3. Using this library can be set any hotkeys, including the F12, CTRL-ALT-DEL, etc. $x=_GUICtrlReadHotKeyInput($HotkeyInput1) _HotKeyAssign($x, "test", $HK_FLAG_NOREPEAT) EDIT: _GUICtrlReadHotKeyInput() returns the combined 16-bit hotkey code, which consists of upper and lower bytes. Hotkey code bits: 0-7 - Specifies the virtual-key (VK) code of the key. Codes for the mouse buttons (0x01 - 0x06) are not supported. For more information see this. 8 - SHIFT key 9 - CONTROL key 10 - ALT key 11 - WIN key 12-15 - Don`t used Edited May 24, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
JackDinn Posted May 24, 2009 Share Posted May 24, 2009 (edited) ahh, there's more btw you really know your stuff nice func's thx, Edited May 24, 2009 by JackDinn Thx all,Jack Dinn. Â JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
Yashied Posted May 24, 2009 Author Share Posted May 24, 2009 (edited) If you want to use HotKeySet(), it is not difficult to write a function to convert the hot keys. It will look like this:Func _HotKeyConvert($iKey) Local $sKey = "" If BitAND($iKey, 0x0100) Then $sKey &= "+" If BitAND($iKey, 0x0200) Then $sKey &= "^" If BitAND($iKey, 0x0400) Then $sRet &= "!" If BitAND($iKey, 0x0800) Then $sRet &= "#" Switch BitAND($iKey, 0x00FF) Case 0x08 $sKey &= "{BACKSPACE}" Case 0x09 $sKey &= "{TAB}" ... EndSwitch Return $sKey EndFunc ;==>_HotKeyConvert Edited May 24, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
JackDinn Posted May 24, 2009 Share Posted May 24, 2009 aye i had started picking apart the return from _KeyToStr() and doing much what your doing there (but not as clean) but i was sure there was an easer way to do it. much thx for your work. Thx all,Jack Dinn. Â JD's Auto Internet Speed Tester JD's Clip Catch (With Screen Shot Helper) Projects :- AutoIt - My projects My software never has bugs. It just develops random features. :-D Link to comment Share on other sites More sharing options...
FunkyBunnies Posted June 6, 2009 Share Posted June 6, 2009 awesome work, yashied! I'm still way too green to understand much of any of it, but it works pretty great. but I noticed that 'backspace' and '-' don't register for me within the control. Another thing I was curious about was the approach to numlock. It looks like windows is still storing the state of numlock when it's pressed in the control. The light is correct on the keyboard itself, and it seems windows knows the state because if you hit numlock again it's on the correct mode, but it looks like it accidentally popped into the wrong mode. anyway, thought I'd ask Link to comment Share on other sites More sharing options...
Yashied Posted June 6, 2009 Author Share Posted June 6, 2009 awesome work, yashied! I'm still way too green to understand much of any of it, but it works pretty great.Thanks. but I noticed that 'backspace' and '-' don't register for me within the control.Single "Backspace" You can not assign a hot key, it is used to clear the input fields (like the "Esc"). "-" - this is an error in the _KeyToStr() function. Fixed. Another thing I was curious about was the approach to numlock. It looks like windows is still storing the state of numlock when it's pressed in the control. The light is correct on the keyboard itself, and it seems windows knows the state because if you hit numlock again it's on the correct mode, but it looks like it accidentally popped into the wrong mode.Indeed, a strange effect. It looks like in Windows you can not completely lock the "Num Lock". The only thing I can suggest at this point - use _KeyLock() to add "Num Lock" in the prohibited list of hot keys. _KeyLock(0x0090) My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
rexx Posted September 15, 2009 Share Posted September 15, 2009 Hi, Can I get the hotkey code on change? I use the code below, and it gets the hotkey text correctly, but the key code seems to be previous one. expandcollapse popup#Include <GUIConstantsEx.au3> #Include <HotKeyInput.au3> Global Const $EN_CHANGE = 0x300 Global $Form, $ButtonOk, $HotkeyInput1, $HotkeyInput2, $GUIMsg Global $t $Form = GUICreate('Test', 300, 160) GUISetFont(8.5, 400, 0, 'Tahoma', $Form) $HotkeyInput1 = _GUICtrlCreateHotKeyInput(0, 56, 55, 230, 20, -1, -1, ' - ') $HotkeyInput2 = _GUICtrlCreateHotKeyInput(0, 56, 89, 230, 20) $InputHotkeyKey = $HotkeyInput1 _KeyLock(0x062E) ; Lock CTRL-ALT-DEL for Hotkey Input control, but not for Windows GUICtrlCreateLabel('Hotkey1:', 10, 58, 44, 14) GUICtrlCreateLabel('Hotkey2:', 10, 92, 44, 14) GUICtrlCreateLabel('Click on Input box and hold a combination of keys.' & @CR & 'Press OK to view the code.', 10, 10, 280, 28) $ButtonOk = GUICtrlCreateButton('OK', 110, 124, 80, 23) GUICtrlSetState(-1, BitOR($GUI_DEFBUTTON, $GUI_FOCUS)) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState() While 1 $GUIMsg = GUIGetMsg() Select Case $GUIMsg = $GUI_EVENT_CLOSE Exit Case $GUIMsg = $ButtonOk $t = ' Hotkey1: 0x' & StringRight(Hex(_GUICtrlReadHotKeyInput($HotkeyInput1)), 4) & ' (' & GUICtrlRead($HotkeyInput1) & ') ' & @CR & @CR & _ ' Hotkey2: 0x' & StringRight(Hex(_GUICtrlReadHotKeyInput($HotkeyInput2)), 4) & ' (' & GUICtrlRead($HotkeyInput2) & ') ' MsgBox(0, 'Code', $t, 0, $Form) EndSelect WEnd Func InputHotkeyChange($iInput) tooltip(GUICtrlRead($InputHotkeyKey)&@LF&_GUICtrlReadHotKeyInput($InputHotkeyKey)) EndFunc Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iCode = _WinAPI_HiWord($wParam) Local $iID = _WinAPI_LoWord($wParam) Local $hCtrl = $lParam if $iCode = $EN_CHANGE then Switch $iID Case $InputHotkeyKey InputHotkeyChange($iID) EndSwitch endif return $GUI_RUNDEFMSG EndFunc Link to comment Share on other sites More sharing options...
Yashied Posted September 15, 2009 Author Share Posted September 15, 2009 Hi, Can I get the hotkey code on change? I use the code below, and it gets the hotkey text correctly, but the key code seems to be previous one. expandcollapse popup#Include <GUIConstantsEx.au3> #Include <HotKeyInput.au3> Global Const $EN_CHANGE = 0x300 Global $Form, $ButtonOk, $HotkeyInput1, $HotkeyInput2, $GUIMsg Global $t $Form = GUICreate('Test', 300, 160) GUISetFont(8.5, 400, 0, 'Tahoma', $Form) $HotkeyInput1 = _GUICtrlCreateHotKeyInput(0, 56, 55, 230, 20, -1, -1, ' - ') $HotkeyInput2 = _GUICtrlCreateHotKeyInput(0, 56, 89, 230, 20) $InputHotkeyKey = $HotkeyInput1 _KeyLock(0x062E) ; Lock CTRL-ALT-DEL for Hotkey Input control, but not for Windows GUICtrlCreateLabel('Hotkey1:', 10, 58, 44, 14) GUICtrlCreateLabel('Hotkey2:', 10, 92, 44, 14) GUICtrlCreateLabel('Click on Input box and hold a combination of keys.' & @CR & 'Press OK to view the code.', 10, 10, 280, 28) $ButtonOk = GUICtrlCreateButton('OK', 110, 124, 80, 23) GUICtrlSetState(-1, BitOR($GUI_DEFBUTTON, $GUI_FOCUS)) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState() While 1 $GUIMsg = GUIGetMsg() Select Case $GUIMsg = $GUI_EVENT_CLOSE Exit Case $GUIMsg = $ButtonOk $t = ' Hotkey1: 0x' & StringRight(Hex(_GUICtrlReadHotKeyInput($HotkeyInput1)), 4) & ' (' & GUICtrlRead($HotkeyInput1) & ') ' & @CR & @CR & _ ' Hotkey2: 0x' & StringRight(Hex(_GUICtrlReadHotKeyInput($HotkeyInput2)), 4) & ' (' & GUICtrlRead($HotkeyInput2) & ') ' MsgBox(0, 'Code', $t, 0, $Form) EndSelect WEnd Func InputHotkeyChange($iInput) tooltip(GUICtrlRead($InputHotkeyKey)&@LF&_GUICtrlReadHotKeyInput($InputHotkeyKey)) EndFunc Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iCode = _WinAPI_HiWord($wParam) Local $iID = _WinAPI_LoWord($wParam) Local $hCtrl = $lParam if $iCode = $EN_CHANGE then Switch $iID Case $InputHotkeyKey InputHotkeyChange($iID) EndSwitch endif return $GUI_RUNDEFMSG EndFunc expandcollapse popup#Include <GUIConstantsEx.au3> #Include <HotKeyInput.au3> Global Const $EN_CHANGE = 0x300 Global $Form, $ButtonOk, $Dummy, $HotkeyInput1, $HotkeyInput2, $GUIMsg Global $t $Form = GUICreate('Test', 300, 160) GUISetFont(8.5, 400, 0, 'Tahoma', $Form) $HotkeyInput1 = _GUICtrlCreateHotKeyInput(0, 56, 55, 230, 20, -1, -1, ' - ') $HotkeyInput2 = _GUICtrlCreateHotKeyInput(0, 56, 89, 230, 20) $InputHotkeyKey = $HotkeyInput1 _KeyLock(0x062E) ; Lock CTRL-ALT-DEL for Hotkey Input control, but not for Windows GUICtrlCreateLabel('Hotkey1:', 10, 58, 44, 14) GUICtrlCreateLabel('Hotkey2:', 10, 92, 44, 14) GUICtrlCreateLabel('Click on Input box and hold a combination of keys.' & @CR & 'Press OK to view the code.', 10, 10, 280, 28) $ButtonOk = GUICtrlCreateButton('OK', 110, 124, 80, 23) GUICtrlSetState(-1, BitOR($GUI_DEFBUTTON, $GUI_FOCUS)) $Dummy = GUICtrlCreateDummy() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState() While 1 $GUIMsg = GUIGetMsg() Select Case $GUIMsg = $GUI_EVENT_CLOSE Exit Case $GUIMsg = $ButtonOk $t = ' Hotkey1: 0x' & StringRight(Hex(_GUICtrlReadHotKeyInput($HotkeyInput1)), 4) & ' (' & GUICtrlRead($HotkeyInput1) & ') ' & @CR & @CR & _ ' Hotkey2: 0x' & StringRight(Hex(_GUICtrlReadHotKeyInput($HotkeyInput2)), 4) & ' (' & GUICtrlRead($HotkeyInput2) & ') ' MsgBox(0, 'Code', $t, 0, $Form) Case $Dummy InputHotkeyChange(GUICtrlRead($Dummy)) EndSelect WEnd Func InputHotkeyChange($iInput) ToolTip(GUICtrlRead($InputHotkeyKey) & @LF & _GUICtrlReadHotKeyInput($InputHotkeyKey)) EndFunc ;==>InputHotkeyChange Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iCode = _WinAPI_HiWord($wParam) Local $iID = _WinAPI_LoWord($wParam) Local $hCtrl = $lParam If $iCode = $EN_CHANGE Then Switch $iID Case $InputHotkeyKey GUICtrlSendToDummy($Dummy, $iID) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
rexx Posted September 15, 2009 Share Posted September 15, 2009 Thanks, it works! But when I use OnEvent mode it does not work. Sorry I should ask for OnEvent mode at the first time. Thanks again! expandcollapse popup#Include <GUIConstantsEx.au3> #Include <HotKeyInput.au3> Opt("GUIOnEventMode", 1) Global Const $EN_CHANGE = 0x300 Global $Form, $ButtonOk, $Dummy, $HotkeyInput1, $HotkeyInput2, $GUIMsg Global $t $Form = GUICreate('Test', 300, 160) GUISetFont(8.5, 400, 0, 'Tahoma', $Form) $HotkeyInput1 = _GUICtrlCreateHotKeyInput(0, 56, 55, 230, 20, -1, -1, ' - ') $HotkeyInput2 = _GUICtrlCreateHotKeyInput(0, 56, 89, 230, 20) $InputHotkeyKey = $HotkeyInput1 _KeyLock(0x062E) ; Lock CTRL-ALT-DEL for Hotkey Input control, but not for Windows GUICtrlCreateLabel('Hotkey1:', 10, 58, 44, 14) GUICtrlCreateLabel('Hotkey2:', 10, 92, 44, 14) GUICtrlCreateLabel('Click on Input box and hold a combination of keys.' & @CR & 'Press OK to view the code.', 10, 10, 280, 28) $ButtonOk = GUICtrlCreateButton('OK', 110, 124, 80, 23) GUICtrlSetState(-1, BitOR($GUI_DEFBUTTON, $GUI_FOCUS)) $Dummy = GUICtrlCreateDummy() GUICtrlSetOnEvent($Dummy, "DummyEvent") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState() While 1 Sleep(10) WEnd Func DummyEvent() InputHotkeyChange(GUICtrlRead($Dummy)) EndFunc Func InputHotkeyChange($iInput) ToolTip(GUICtrlRead($InputHotkeyKey) & @LF & _GUICtrlReadHotKeyInput($InputHotkeyKey)) EndFunc ;==>InputHotkeyChange Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iCode = _WinAPI_HiWord($wParam) Local $iID = _WinAPI_LoWord($wParam) Local $hCtrl = $lParam If $iCode = $EN_CHANGE Then Switch $iID Case $InputHotkeyKey GUICtrlSendToDummy($Dummy, $iID) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Link to comment Share on other sites More sharing options...
Yashied Posted September 15, 2009 Author Share Posted September 15, 2009 OK!Replace the following part of code in the HotKeyInput.au3If $VK[$vkCode] > '' Then $Key = BitOR(BitShift($hkId[0][3], -8), $vkCode) If Not _HotKeyInput_Lock($Key) Then GUICtrlSetData($hkId[$Index][0], _KeyToStr($Key, $hkId[$Index][3])) $hkId[$Index][2] = $Key $hkId[0][7] = 1 $hkId[0][8] = 1 Else $Return = 0 EndIf EndIftoIf $VK[$vkCode] > '' Then $Key = BitOR(BitShift($hkId[0][3], -8), $vkCode) If Not _HotKeyInput_Lock($Key) Then $hkId[$Index][2] = $Key GUICtrlSetData($hkId[$Index][0], _KeyToStr($Key, $hkId[$Index][3])) $hkId[0][7] = 1 $hkId[0][8] = 1 Else $Return = 0 EndIf EndIf My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
rexx Posted September 15, 2009 Share Posted September 15, 2009 OK!Replace the following part of code in the HotKeyInput.au3Great!I don't even need the dummy control.Thanks. Link to comment Share on other sites More sharing options...
OwiDowiSpinn Posted April 1, 2010 Share Posted April 1, 2010 The UDF doesn't work on my AutoIt version Can you update it? Link to comment Share on other sites More sharing options...
Yashied Posted April 1, 2010 Author Share Posted April 1, 2010 And what is the reason? My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now