hunt Posted June 10, 2009 Share Posted June 10, 2009 (edited) This is a small UDF for Hotkey (msctls_hotkey32) which allow to: 1) Create HotKey control (msctls_hotkey32) 2) Get and value(number) from HotKey control 3) Set value(number) in HotKey control 4) Get Hotkey format from Hotkey control which can be used in function HotKeySet 5) Get normal format from Hotkey control 6) Set rules for Hotkey control Thanks to Achilles for his Hotkey example which help me to do this UDF. Current functions: _GuiCtrlHotKey_Create - Create a HotKey control _GuiCtrlHotKey_GetHotkey - Get number identifying pressed keys in HotKey control _GuiCtrlHotKey_SetHotkey - Set Hotkey in HotKey Control _GuiCtrlHotKey_GetFormat - Get Normal and HotKey format from unique HotKey number _GuiCtrlHotKey_GetFullInfo - Get Normal and HotKey format and also HotKey number from HotKey Control _GuiCtrlHotKey_SetRules - Set rules for HotKey control HotKey example (hotkey_example.au3): expandcollapse popup#include-once #include <hotkeys.au3> #cs -----------Flags for rules:----------- Invalid keys: (used when need to block combination of keys) $HKCOMB_NONE - Unmodified keys; it is blocked nothing, it is used only for "Modifiers" $HKCOMB_S - SHIFT $HKCOMB_C - CTRL $HKCOMB_A - ALT $HKCOMB_SC - SHIFT+CTRL $HKCOMB_SA - SHIFT+ALT $HKCOMB_CA - CTRL+ALT $HKCOMB_SCA - SHIFT+CTRL+ALT Modifiers: (this modifiers are established when pressed "Invalid keys") $HOTKEYF_SHIFT - SHIFT $HOTKEYF_CONTROL - CTRL $HOTKEYF_ALT - ALT $HOTKEYF_EXT - Extra key ---------------------------------------------- #ce Global $HotKey $gui_Main = GUICreate('Get Hotkey', 220, 90) $bt = GUICtrlCreateButton('See Value', 10, 50, 200, 30); GUICtrlSetState(-1, $GUI_DEFBUTTON) $hWnd=_GuiCtrlHotKey_Create($gui_Main,10,10,180,25,0); <= Create Hotkey ;_GuiCtrlHotKey_SetRules($hWnd,$HKCOMB_S) ; <= Set rules for Hotkey (blocks shift-key) ;_GuiCtrlHotKey_SetRules($hWnd,$HKCOMB_C,BitOr($HOTKEYF_CONTROL,$HOTKEYF_ALT)); <= Set rules for Hotkey (pressing ctrl = ctrl+alt) Send("{NUMLOCK on}") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $bt $hotkey_info=_GuiCtrlHotKey_GetFullInfo($hWnd); <= Get Info about Hotkey If $hotkey_info<>-1 Then MsgBox(64,"Information","HotKey format: " & $hotkey_info[0] & _ @CRLF & "Normal format: " & $hotkey_info[1] & _ @CRLF & "HotKey value: " & $hotkey_info[2]) HotKeySet($hotkey); clear previous hotkey $hotkey=$hotkey_info[0] HotKeySet($hotkey,"hello") Endif EndSwitch WEnd Func hello() MsgBox(64,"","Hello!") EndFunc Example: hotkey_example.au3UDF: hotkeys.au3 Edited June 10, 2009 by hunt LukeLe 1 Link to comment Share on other sites More sharing options...
JRSmile Posted June 10, 2009 Share Posted June 10, 2009 It isn't the same as HotKeySet() is it? would you be so kind and tell the difference between HotKeySet() and your GuiCtrlHotKey_Create()? Best regards, J. $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Link to comment Share on other sites More sharing options...
JRSmile Posted June 10, 2009 Share Posted June 10, 2009 nevermind found it by myself:Differences HotKeySet() from HotKeyAssign():- You can use any combination of keys such as CTRL-ALT-DEL or F12- Ability to set repeating delay and rate (see $iDelay and $iRate parameters)- Ability to set hot keys for the specified window (see $iTitle parameter)- You can use hot keys to permit other program or block them (see $iFlag parameter)- You can temporarily turn on or off set hotkeys (see _HotKeyEnable() and _HoyKeyDisable() functionsFrom the description HotKeySet() can be concluded that it uses "RegisterHotKey", which has several limitations.http://msdn.microsoft.com/en-us/library/ms913104.aspxhttp://www.autoitscript.com/autoit3/docs/f...s/HotKeySet.htm $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Link to comment Share on other sites More sharing options...
hunt Posted June 10, 2009 Author Share Posted June 10, 2009 (edited) JRSmileI have committed a small error in the topic name.This is UDF for HotKey Control. Edited June 10, 2009 by hunt Link to comment Share on other sites More sharing options...
Yashied Posted June 10, 2009 Share Posted June 10, 2009 Good job.Here is my version of Hotkeys Input Control UDF Library. LukeLe 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...
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