LordJim60 Posted October 12, 2011 Share Posted October 12, 2011 (edited) Hi, sorry for my bad english....Developing with your HotKey.au3, I have found a little bit problem:Under XP (with Seven this doesn't happen) if I include "Hotkey.au3" but I don't assign any Hot Key, at the end of the program I receive an win32 exception error. This seems due to the function "OnHotKeyExit ()" that in every case it executes:DllCallbackFree($hkTb[0][4]) By the way, to avoid this, I've changed the line in: If IsPtr( $hkTb[0][4] ) Then DllCallbackFree($hkTb[0][4]) thanks a lot for your work :-) Edited October 12, 2011 by LordJim60 Link to comment Share on other sites More sharing options...
Yashied Posted October 18, 2011 Author Share Posted October 18, 2011 (edited) The library has been updated. v1.7 / 2.0b Added compatibility with UAC elevated windows (Windows Vista+). (Thanks Ascend4nt, KaFu, and Me )Renamed _HotKey* to _HotKey_*. Edited October 18, 2011 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...
LSTemp Posted November 26, 2011 Share Posted November 26, 2011 LAST VERSION - 1.7 / 2.0b 17-Oct-11 The library allows to set hotkeys by using the low-level keyboard hook. Below are the main differences between HotKey UDF from the native HotKeySet() function.To assign a hotkeys are used integer values instead of strings as in the HotKeySet() function. This is useful, for example, to save the hotkey's values in the registry.Ability to set any hotkeys including CTRL+ALT+DEL, F12, WIN+*, etc. The only exceptions are special keys such as "Fn" which do not have their own scan code.Ability to utilize or pass on the specified hotkeys for other applications.Ability to set hotkeys that already used by other applications.Ability to set hotkeys only for the specified window(s).Ability to prevent re-activation of the hotkeys when it is held down.Ability to disable previously installed hotkeys without removing the hook from the hook chain, ie without losing priority.Ability to block call user-defined function associated with the hotkey if the previous call has not been completed.Here is what you can not do by using this library.Set hotkey only for the CTRL, ALT, SHIFT, WIN, and any combination of this keys. Any hotkey should always include one function key. For example, ALT+A, CTRL+SHIFT+F10, etc.Set hotkey for a mouse buttons.Prevent using the hotkey like CTRL+ALT+DEL, CTRL+SHIFT+ESC (Windows Vista+), and similar.Use more than one function key in the hotkey. For example, ALT+A+B, F1+F2, etc.Use "Fn" key or any other keys that do not have their own scan code. HotKey UDF Library v1.7 (Previous downloads: 2618) HotKey UDF Library v2.0b (Read for more information) (Previous downloads: 289) Virtual-Key (VK) Code Constants (Optional) (Previous downloads: 1576) vkConstants.au3 Example1 #Include <HotKey.au3> Global Const $VK_ESCAPE = 0x1B Global Const $VK_F12 = 0x7B ; Assign "F12" with Message() and set extended function call _HotKey_Assign($VK_F12, 'Message', BitOR($HK_FLAG_DEFAULT, $HK_FLAG_EXTENDEDCALL)) ; Assign "CTRL-ESC" with Quit() _HotKey_Assign(BitOR($CK_CONTROL, $VK_ESCAPE), 'Quit') While 1 Sleep(10) WEnd Func Message($iKey) MsgBox(0, 'Hot key Test Message', 'F12 (0x' & Hex($iKey, 4) & ') has been pressed!') EndFunc ;==>Message Func Quit() Exit EndFunc ;==>Quit Example2 #Include <HotKey.au3> Global Const $VK_OEM_PLUS = 0xBB Global Const $VK_OEM_MINUS = 0xBD Global $Form, $Label Global $i = 0 $Form = GUICreate('MyGUI', 200, 200) $Label = GUICtrlCreateLabel($i, 20, 72, 160, 52, 0x01) GUICtrlSetFont(-1, 32, 400, 0, 'Tahoma') GUISetState() ; Assign "CTRL-(+)" with MyFunc1() and "CTRL-(-)" with MyFunc2() for created window only _HotKey_Assign(BitOR($CK_CONTROL, $VK_OEM_PLUS), 'MyFunc1', 0, $Form) _HotKey_Assign(BitOR($CK_CONTROL, $VK_OEM_MINUS), 'MyFunc2', 0, $Form) Do Until GUIGetMsg() = -3 Func MyFunc1() $i += 1 GUICtrlSetData($Label, $i) EndFunc ;==>MyFunc1 Func MyFunc2() $i -= 1 GUICtrlSetData($Label, $i) EndFunc ;==>MyFunc2 Example3 expandcollapse popup#Include <GUIConstants.au3> #Include <HotKey.au3> Global Const $VK_ESCAPE = 0x1B Global Const $VK_F12 = 0x7B ; Assign "F12" with Form() _HotKey_Assign($VK_F12, 'Form') ; Assign "CTRL-ESC" with Quit() _HotKey_Assign(BitOR($CK_CONTROL, $VK_ESCAPE), 'Quit') While 1 Sleep(10) WEnd Func Form() Local $Form, $Button, $Msg $Form = GUICreate('MyGUI', 350, 350, -1, -1, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_TOPMOST) $Button = GUICtrlCreateButton('Exit', 140, 315, 70, 23) GUICtrlSetState(-1, BitOR($GUI_DEFBUTTON, $GUI_FOCUS)) GUISetState(@SW_SHOW, $Form) While 1 Switch GUIGetMsg() Case $Button, $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($Form) EndFunc ;==>Form Func Quit() Exit EndFunc ;==>Quit nice idea & many great word, but simple problem: any another LL hook after U can block all UDF functional. U need ability 4 track what U hook is 1'st in chain. Any idea 4 realisation? ) Link to comment Share on other sites More sharing options...
iCode Posted December 1, 2011 Share Posted December 1, 2011 (edited) HotKey 2.0b - running obfusicator this is with 3.3.6.1 and 3.3.7.21 beta, compile switches don't seem to matter (this is with no switches) debugging isn't an option as this is out of my league -### Obfuscation Error: Found Call() statement using unsolvable Func, which will/could lead to problems running your obfuscated script. >### current Func: HK_WM_HOTKEY F:AutoIt_Funcs_OtherHotKey_HotKey.au3(735,1) Warning for line:Call($hkTb[$lParam][1], $Key) -### Obfuscation Error: Found Call() statement using unsolvable Func, which will/could lead to problems running your obfuscated script. >### current Func: HK_WM_HOTKEY F:AutoIt_Funcs_OtherHotKey_HotKey.au3(737,1) Warning for line:Call($hkTb[$lParam][1]) Func HK_WM_HOTKEY($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hkTb[0][11] Local $Key = $hkTb[$lParam][0] Switch $wParam Case 0 Case 1 $Key = -$Key Case Else Return EndSwitch $hkTb[0][10] += 1 $hkTb[$lParam][8] += 1 If $hkTb[$lParam][6] = 1 Then Call($hkTb[$lParam][1], $Key) Else Call($hkTb[$lParam][1]) EndIf $hkTb[$lParam][8] -= 1 $hkTb[0][10] -= 1 ;~ If (@error = 0xDEAD) And (@extended = 0xBEEF) Then ;~ __HK_Error($hkTb[$lParam][1] & '(): Function does not exist or invalid number of parameters.') ;~ EndIf EndSwitch EndFunc ;==>HK_WM_HOTKEY #AutoIt3Wrapper_Version=Beta #AutoIt3Wrapper_Outfile=tst.exe #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Fileversion=0.0.0.0 #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Run_AU3Check=y #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 4 #AutoIt3Wrapper_Run_Obfuscator=y Edited December 1, 2011 by iCode FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences) CODE SNIPPITS: Dynamic tab width (set tab control width according to window width) Link to comment Share on other sites More sharing options...
KaFu Posted December 1, 2011 Share Posted December 1, 2011 You have to add the functions you want to call via the hotkey to Obfuscators ignore list. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Obfuscator_Ignore_Funcs=_HK_Message,_HK_Quit #include <HotKey_20b.au3> Global Const $VK_ESCAPE = 0x1B Global Const $VK_F12 = 0x7B ; Assign "F12" with Message() and set extended function call _HotKey_Assign($VK_F12, '_HK_Message', BitOR($HK_FLAG_DEFAULT, $HK_FLAG_EXTENDEDCALL)) ; Assign "CTRL-ESC" with Quit() _HotKey_Assign(BitOR($CK_CONTROL, $VK_ESCAPE), '_HK_Quit') While 1 Sleep(10) WEnd Func _HK_Message($iKey) MsgBox(0, 'Hot key Test Message', 'F12 (0x' & Hex($iKey, 4) & ') has been pressed!') EndFunc ;==>Message Func _HK_Quit() Exit EndFunc ;==>Quit OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
iCode Posted December 1, 2011 Share Posted December 1, 2011 thanks, i will do do that must this be done because of the nature of the script, or because it is still being polished? FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences) CODE SNIPPITS: Dynamic tab width (set tab control width according to window width) Link to comment Share on other sites More sharing options...
KaFu Posted December 1, 2011 Share Posted December 1, 2011 This is because of the nature of the script and how Obfuscator works. With _HotKey_Assign() you pass the function name as a string, the HotKey UDF transforms this string into a function call. Obfuscator looks for function calls and strips / encrypts them accordingly and replaces their occurences. There is no way Obfuscator can interpret the string in _HotKey_Assign() as a function name. Imagine you pass a function called "Test" to _HotKey_Assign(), should Obfuscator replace all strings "Test" to the obfuscated value? OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
iCode Posted December 1, 2011 Share Posted December 1, 2011 thank you very much for the detailed explanation! FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences) CODE SNIPPITS: Dynamic tab width (set tab control width according to window width) Link to comment Share on other sites More sharing options...
KaFu Posted December 1, 2011 Share Posted December 1, 2011 You're welcome ... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
LSTemp Posted February 5, 2012 Share Posted February 5, 2012 nothing new. what about my old quest: hook-track? any game 2day overlap u LL. simple... Link to comment Share on other sites More sharing options...
Developers Jos Posted February 5, 2012 Developers Share Posted February 5, 2012 nothing new.what about my old quest: hook-track? any game 2day overlap u LL. simple...Don't believe we care too much about your issue with game overlap issue.You did read the forum rules I hope. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Mikeman27294 Posted February 10, 2012 Share Posted February 10, 2012 Hey, I am storing my hotkeys in a settings file (ini), by writing the value of a bitor to the file. Is there any way that after reading the value from the file, I can reverse this bitor? Otherwise I will have to run a BitOr each time I run the program. Thanks. Link to comment Share on other sites More sharing options...
Mikeman27294 Posted February 20, 2012 Share Posted February 20, 2012 Anybody? I expect that it can be done somehow because the program can set the 2 hotkeys appropreately. How would I go about doing this? Link to comment Share on other sites More sharing options...
KaFu Posted February 20, 2012 Share Posted February 20, 2012 I do not understand your request. Maybe you post an example that shows what's going wrong ... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Mikeman27294 Posted February 21, 2012 Share Posted February 21, 2012 Ok, it's hard to explain, but I will do my best. So for hotkeys, let's say Ctrl and Z. We have to bitor these. So like this: $CK_CONTROL = 512 $VK_Z = 90 $Hotkey = BitOR($CK_CONTROL, $VK_Z); $Hotkey = 602 The value of $Hotkey is stored in an INI file. Now, when I start the program, I want to read the INI file, and then reverse the BitOr like so: $Hotkey = IniRead($SettingsINIFile, "Hotkeys", "Undo", "602) $HotkeysArray = Un-BitOr($Hotkey); Which in theory, should return a 2 element array containing 512 and 90. How would I go about doing this? The reason I want to do this, is so that the user can have the current hotkeys in my options menu, as well as in my menu items. Can this be done? Thanks. Link to comment Share on other sites More sharing options...
Yashied Posted February 21, 2012 Author Share Posted February 21, 2012 (edited) $VK_Key = BitAND($Hotkey, 0xFF) $CK_Flags = BitAND($Hotkey, 0xFF00) But it unnecessary. $Hotkey = IniRead($SettingsINIFile, "Hotkeys", "Undo", "602") _HotKey_Assign($Hotkey, ...) Edited February 21, 2012 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...
Mikeman27294 Posted February 21, 2012 Share Posted February 21, 2012 Yes, but I also want for it to return the original 2 keys. Basically, I want it to return the 2 keys that I BitOr'd originally. So what I want, is for it to take 602 and return both the hex values for the ctrl key and the z key. So it is like undoing the BitOr, but I want it to work for any hotkey combination. How would I go about doing that? Link to comment Share on other sites More sharing options...
KaFu Posted February 21, 2012 Share Posted February 21, 2012 Loop through all possible values and check with bitand if the value is in the your current combination. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Mikeman27294 Posted February 21, 2012 Share Posted February 21, 2012 Hmm... I think that I'll just store the values in the INI file then BitOr them when I start up my program. Thanks. Link to comment Share on other sites More sharing options...
Yashied Posted February 21, 2012 Author Share Posted February 21, 2012 $VK = BitAND($Hotkey, 0xFF) Select Case BitAND($Hotkey, $CK_SHIFT) $CK = $CK_SHIFT Case BitAND($Hotkey, $CK_CONTROL) $CK = $CK_CONTROL Case BitAND($Hotkey, $CK_ALT) $CK = $CK_ALT Case BitAND($Hotkey, $CK_WIN) $CK = $CK_WIN Case Else $CK = 0 EndSelect 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