Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/03/2023 in all areas

  1. Andreik

    HotKeySetEx

    I saw some old posts where people complained that HotKeySet() doesn't work for some keys like F13 - F24. I made some tests and I end up with this. #include-once Global $__dummy_win, $__mHotkeys[] Func HotKeyInit() $__dummy_win = GUICreate('', 0, 0, 0, 0, 0x80000000) GUISetState(@SW_SHOW, $__dummy_win) GUIRegisterMsg(0x0312, 'WM_HOTKEY') EndFunc Func HotKeyUnInit() GUIRegisterMsg(0x0312, '') GUIDelete($__dummy_win) EndFunc Func HotKeySetEx($vkCode, $sFunction) Local $aCall, $aHotkey[2] Local Static $iID = 0 $iID += 1 $aCall = DllCall('user32.dll', 'bool', 'RegisterHotKey', 'hwnd', $__dummy_win, 'int', $iID, 'uint', 0x4000, 'uint', $vkCode) If $aCall[0] <> 0 Then $aHotkey[0] = $iID $aHotkey[1] = $sFunction $__mHotkeys[$vkCode] = $aHotkey EndIf Return $aCall[0] EndFunc Func HotKeyUnset($vkCode) Local $iID = ($__mHotkeys[$vkCode])[0] Local $aCall = DllCall('user32.dll', 'bool', 'UnregisterHotKey', 'hwnd', $__dummy_win, 'int', $iID) If $aCall[0] <> 0 Then MapRemove($__mHotkeys, $vkCode) Return $aCall[0] EndFunc Func WM_HOTKEY($hWnd, $iMsg, $wParam, $lParam) Local $vkCode = BitShift($lParam, 16) If MapExists($__mHotkeys, $vkCode) Then Local $aHotkey = $__mHotkeys[$vkCode] Call($aHotkey[1]) EndIf Return 'GUI_RUNDEFMSG' EndFunc And here is a basic example: #include <HotKeySetEx.au3> Global Const $F13 = 0x7C HotKeyInit() HotKeySetEx($F13, 'Test') ; Simulate F13 DllCall('user32.dll', 'none', 'keybd_event', 'byte', $F13, 'byte', 0x64, 'dword', 0, 'ulong_ptr', 0) While True Sleep(10) WEnd HotKeyUnset($F13) HotKeyUnInit() Func Test() MsgBox(0, '', 'Test') Exit EndFunc I am not aware about native HotKeySet() implementation but I wonder if it's a trivial task to add these extended function keys so it won't be necessary to register them in that way. Some might argue that keyboards now don't use these keys anymore, but it's not true at all. There are some new keyboard having these physical keys (picture below), but they are rare indeed. Edit: after a quick look over an older version of AutoIt source code it seems trivial to allow these function keys to be used as hotkeys. However, I'm not sure how much HotKeySet() has been changed in the newer versions of AutoIt.
    1 point
  2. mesale0077 asked me whether I could code some CSS loading animations from different web sites. These are the results using GDI+ (AutoIt v3.3.12.0+ required!): _GDIPlus_MonochromaticBlinker.au3 / _GDIPlus_RotatingBokeh.au3 _GDIPlus_SpinningCandy.au3 / _GDIPlus_SteamPunkLoading.au3 _GDIPlus_IncreasingBalls.au3 / _GDIPlus_PacmanProgressbar.au3 _GDIPlus_StripProgressbar.au3 / _GDIPlus_RingProgressbar.au3 _GDIPlus_LineProgressbar.au3 / _GDIPlus_SimpleLoadingAnim.au3 _GDIPlus_TextFillingWithWater.au3 / _GDIPlus_MultiColorLoader.au3 _GDIPlus_LoadingSpinner.au3 / _GDIPlus_SpinningAndPulsing.au3 _GDIPlus_TogglingSphere.au3 / _GDIPlus_CloudySpiral.au3 _GDIPlus_GlowingText.au3 (thanks to Eukalyptus) / _GDIPlus_HypnoticLoader.au3 _GDIPlus_RotatingRectangles.au3 / _GDIPlus_TRONSpinner.au3 _GDIPlus_RotatingBars.au3 / _GDIPlus_AnotherText.au3 (thanks to Eukalyptus) _GDIPlus_CogWheels.au3 (thanks to Eukalyptus) / _GDIPlus_DrawingText.au3 (thanks to Eukalyptus) _GDIPlus_GearsAnim.au3 / _GDIPlus_LEDAnim.au3 _GDIPlus_LoadingTextAnim.au3 / _GDIPlus_MovingRectangles.au3 _GDIPlus_SpinningAndGlowing.au3 (thanks to Eukalyptus) / _GDIPlus_YetAnotherLoadingAnim.au3 _GDIPlus_AnimatedTypeLoader.au3 / _GDIPlus_Carousel.au3 Each animation function has a built-in example how it can be used. AiO download: GDI+ Animated Wait Loading Screens.7z (previous downloads: 1757) Big thanks to Eukalyptus for providing several examples. Maybe useful for some of you Br, UEZ PS: I don't understand CSS - everything is made out of my mind, so it might be different from original CSS examples
    1 point
×
×
  • Create New...