-
Posts
6,029 -
Joined
-
Last visited
-
Days Won
210
argumentum last won the day on June 2
argumentum had the most liked content!
About argumentum

Profile Information
-
Member Title
✨Universalist ✨
-
Location
I'm in your browser now =)
-
WWW
https://www.youtube.com/watch?v=SjwX-zMRxO0&t=5s
-
Interests
Relax
Recent Profile Visitors
argumentum's Achievements
-
mLipok reacted to a post in a topic:
Hotkey control example
-
argumentum reacted to a post in a topic:
JSON UDF using JSON-C
-
..again, is not a solution, but rather a hack to get by until he fix it 🤷♂️
-
#include <ButtonConstants.au3> #include <WindowsStylesConstants.au3> #include <GuiButton.au3> #include <APIThemeConstants.au3> #include <WinAPITheme.au3> #include <WinAPIGdi.au3> #include <APIGdiConstants.au3> #include <StructureConstants.au3> #include <WindowsNotifsConstants.au3> #include <WinAPISysInternals.au3> #include <WinAPIShellEx.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global Const $BP_RADIOBUTTON = 2 Global Const $BP_CHECKBOX = 3 Global Const $BP_GROUPBOX = 4 Global Const $GBS_NORMAL = 1 Global Const $GBS_DISABLED = 2 Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 300, 200) GUISetBkColor("0x202020") ; Register Subclassing / Window Procedure Local $hSubclass = DllCallbackRegister(__GUIDarkTheme_ButtonProc, "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr") Local $hGroupProc = DllCallbackRegister(__GUIDarkTheme_GroupProc, "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr") Local $idGroup = GUICtrlCreateGroup("Group 1", 30, 40, 140, 110) Local $hGroup = GUICtrlGetHandle(-1) Local $idRadio1 = GUICtrlCreateRadio("Radio 1", 40, 65) Local $hRadio1 = GUICtrlGetHandle(-1) Local $idRadio2 = GUICtrlCreateRadio("Radio 2", 40, 95) Local $hRadio2 = GUICtrlGetHandle(-1) GUICtrlCreateGroup("", -99, -99, 1, 1) ; close group Local $idButton_Close = GUICtrlCreateButton("Close", 210, 160) _WinAPI_SetWindowTheme(GUICtrlGetHandle(-1), "DarkMode_Explorer") ; Subclass group _WinAPI_SetWindowSubclass($hGroup, DllCallbackGetPtr($hGroupProc), $idGroup) ; Subclass controls Local $sStyles = "BS_AUTORADIOBUTTON, WS_CHILD, WS_VISIBLE, WS_TABSTOP" Local $tStruct2 = DllStructCreate("struct;int;wchar[256];endstruct") DllStructSetData($tStruct2, 1, $BP_RADIOBUTTON) DllStructSetData($tStruct2, 2, $sStyles) _WinAPI_SetWindowSubclass($hRadio1, DllCallbackGetPtr($hSubclass), $idRadio1, DllStructGetPtr($tStruct2)) Local $tStruct3 = DllStructCreate("struct;int;wchar[256];endstruct") DllStructSetData($tStruct3, 1, $BP_RADIOBUTTON) DllStructSetData($tStruct3, 2, $sStyles) _WinAPI_SetWindowSubclass($hRadio2, DllCallbackGetPtr($hSubclass), $idRadio2, DllStructGetPtr($tStruct3)) ; Display the GUI GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop EndSwitch WEnd ; Cleanup: Restore original Window Procedure _WinAPI_RemoveWindowSubclass($hRadio1, DllCallbackGetPtr($hSubclass), $idRadio1) _WinAPI_RemoveWindowSubclass($hRadio2, DllCallbackGetPtr($hSubclass), $idRadio2) _WinAPI_RemoveWindowSubclass($hGroup, DllCallbackGetPtr($hGroupProc), $idGroup) DllCallbackFree($hSubclass) DllCallbackFree($hGroupProc) GUIDelete($hGUI) EndFunc ;==>Example Func __GUIDarkTheme_GroupProc($hWnd, $iMsg, $wParam, $lParam, $iID, $pData) Switch $iMsg Case $WM_ERASEBKGND Return 1 ; Prevent background erasing to avoid flickering Case $WM_PAINT Local $tPaint = DllStructCreate($tagPAINTSTRUCT) Local $hDC = _WinAPI_BeginPaint($hWnd, $tPaint) Local $tClient = _WinAPI_GetClientRect($hWnd) Local $iW = $tClient.Right Local $iH = $tClient.Bottom ; Initiate double buffering Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC) Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local $hOldBmp = _WinAPI_SelectObject($hMemDC, $hBitmap) ; Setup font matching current GUI configuration Local $hFont = _SendMessage($hWnd, $WM_GETFONT, 0, 0) If Not $hFont Then $hFont = _WinAPI_GetStockObject($DEFAULT_GUI_FONT) Local $hOldFont = _WinAPI_SelectObject($hMemDC, $hFont) ; Ensure parent background is drawn cleanly over empty buffer _WinAPI_DrawThemeParentBackground($hWnd, $hMemDC, $tClient) ; Get text from groupbox Local $sText = _WinAPI_GetWindowText($hWnd) Local $tTextSize = _WinAPI_GetTextExtentPoint32($hMemDC, $sText) Local $iTextWidth = $tTextSize.X Local $iTextHeight = $tTextSize.Y ; Compute Frame geometry (Border centers vertically across text height) Local $tFrameRect = _WinAPI_GetClientRect($hWnd) $tFrameRect.Top += Int($iTextHeight / 2) ; Compute accurately-padded exclusion rectangle for text cutout Local $tClipRect = _WinAPI_CreateRectEx(7, 0, $iTextWidth + 6, $iTextHeight) If $sText <> "" Then _WinAPI_ExcludeClipRect($hMemDC, $tClipRect) EndIf ; Draw border frame (Using a subtle dark gray frame for modern Dark mode appearance) Local $hBrush = _WinAPI_CreateSolidBrush(_WinAPI_SwitchColor(0x505050)) _WinAPI_FrameRect($hMemDC, $tFrameRect, $hBrush) _WinAPI_DeleteObject($hBrush) ; Remove clipping region restriction to render text safely _WinAPI_SelectClipRgn($hMemDC, 0) ; Draw Groupbox Label text if it exists If $sText <> "" Then Local $hTheme = _WinAPI_OpenThemeData($hWnd, "DarkMode_Explorer::Button") Local $tDTTOPTS = DllStructCreate($tagDTTOPTS) DllStructSetData($tDTTOPTS, 'Size', DllStructGetSize($tDTTOPTS)) DllStructSetData($tDTTOPTS, 'Flags', $DTT_TEXTCOLOR) DllStructSetData($tDTTOPTS, 'clrText', 0xFFFFFF) ; Pure white text Local $iTextFlags = BitOR($DT_SINGLELINE, $DT_LEFT, $DT_TOP) Local $tDrawTextRect = _WinAPI_CreateRectEx(9, 0, $iTextWidth, $iTextHeight) _WinAPI_DrawThemeTextEx($hTheme, $BP_GROUPBOX, $GBS_NORMAL, $hMemDC, $sText, $tDrawTextRect, $iTextFlags, $tDTTOPTS) _WinAPI_CloseThemeData($hTheme) EndIf ; Blit memory buffer back to main UI thread Paint DC _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hMemDC, 0, 0, $SRCCOPY) ; Thorough Device Context Resource Cleanup _WinAPI_SelectObject($hMemDC, $hOldFont) _WinAPI_SelectObject($hMemDC, $hOldBmp) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) _WinAPI_EndPaint($hWnd, $tPaint) Return 0 EndSwitch Return __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>__GUIDarkTheme_GroupProc Func __GUIDarkTheme_ButtonProc($hWnd, $iMsg, $wParam, $lParam, $iID, $pData) Switch $iMsg Case $WM_ERASEBKGND Return 1 Case $WM_PAINT Local $tStruct = DllStructCreate("struct;int;wchar[256];endstruct", $pData) Local $iPartID = DllStructGetData($tStruct, 1) Local $sStyles = DllStructGetData($tStruct, 2) Local $hTheme = _WinAPI_OpenThemeData($hWnd, "DarkMode_Explorer::Button") Local $iStateID = 0 Local Const $BST_HOT = 0x0200 Local Const $RBS_UNCHECKEDNORMAL = 1, $RBS_UNCHECKEDHOT = 2, $RBS_UNCHECKEDPRESSED = 3, $RBS_UNCHECKEDDISABLED = 4 Local Const $RBS_CHECKEDNORMAL = 5, $RBS_CHECKEDHOT = 6, $RBS_CHECKEDPRESSED = 7, $RBS_CHECKEDDISABLED = 8 Local $tPaint = DllStructCreate($tagPAINTSTRUCT) Local $hDC = _WinAPI_BeginPaint($hWnd, $tPaint) Local $tClient = _WinAPI_GetClientRect($hWnd) Local $iW = $tClient.Right Local $iH = $tClient.Bottom Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC) Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local $hOldBmp = _WinAPI_SelectObject($hMemDC, $hBitmap) Local $iState = _GUICtrlButton_GetState($hWnd) If Not _WinAPI_IsWindowEnabled($hWnd) Then $iStateID = BitAND($iState, $BST_CHECKED) ? $RBS_CHECKEDDISABLED : $RBS_UNCHECKEDDISABLED ElseIf BitAND($iState, $BST_PUSHED) Then $iStateID = BitAND($iState, $BST_CHECKED) ? $RBS_CHECKEDPRESSED : $RBS_UNCHECKEDPRESSED ElseIf BitAND($iState, $BST_HOT) Then $iStateID = BitAND($iState, $BST_CHECKED) ? $RBS_CHECKEDHOT : $RBS_UNCHECKEDHOT Else $iStateID = BitAND($iState, $BST_CHECKED) ? $RBS_CHECKEDNORMAL : $RBS_UNCHECKEDNORMAL EndIf Local $iTextFlags = BitOR($DT_SINGLELINE, $DT_NOCLIP, $DT_VCENTER, $DT_LEFT) If StringInStr($sStyles, "BS_RIGHT") Then $iTextFlags = BitOR($DT_SINGLELINE, $DT_NOCLIP, $DT_VCENTER, $DT_RIGHT) If StringInStr($sStyles, "BS_CENTER") Then $iTextFlags = BitOR($DT_SINGLELINE, $DT_NOCLIP, $DT_VCENTER, $DT_CENTER) Local $tTextRect = _WinAPI_GetThemeBackgroundContentRect($hTheme, $iPartID, $iStateID, $hMemDC, $tClient) Local $tSIZE = _WinAPI_GetThemePartSize($hTheme, $iPartID, 0, Null, Null, $TS_TRUE) Local $sText = _WinAPI_GetWindowText($hWnd) _WinAPI_DrawThemeParentBackground($hWnd, $hMemDC, $tClient) Local $iWidth = $tSIZE.X Local $iHeight = $tSIZE.Y Local $iClientHeight = $tClient.Bottom - $tClient.Top Local $iYOffset = Int(($iClientHeight - $iHeight) / 2) Local $tRect = _WinAPI_CreateRectEx(0, $iYOffset, $iWidth, $iHeight) _WinAPI_DrawThemeBackground($hTheme, $iPartID, $iStateID, $hMemDC, $tRect) Local $tDTTOPTS = DllStructCreate($tagDTTOPTS) DllStructSetData($tDTTOPTS, 'Size', DllStructGetSize($tDTTOPTS)) DllStructSetData($tDTTOPTS, 'Flags', $DTT_TEXTCOLOR) DllStructSetData($tDTTOPTS, 'clrText', 0xFFFFFF) Local $hFont = _SendMessage($hWnd, $WM_GETFONT, 0, 0) If Not $hFont Then $hFont = _WinAPI_GetStockObject($DEFAULT_GUI_FONT) Local $hOldFont = _WinAPI_SelectObject($hMemDC, $hFont) $tTextRect.Left = $tRect.Right + 4 _WinAPI_DrawThemeTextEx($hTheme, $iPartID, $iStateID, $hMemDC, $sText, $tTextRect, $iTextFlags, $tDTTOPTS) _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hMemDC, 0, 0, $SRCCOPY) _WinAPI_CloseThemeData($hTheme) _WinAPI_SelectObject($hMemDC, $hOldFont) _WinAPI_SelectObject($hMemDC, $hOldBmp) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) _WinAPI_EndPaint($hWnd, $tPaint) Return 0 EndSwitch Return __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>__GUIDarkTheme_ButtonProc Func __WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) Return DllCall('comctl32.dll', 'lresult', 'DefSubclassProc', 'hwnd', $hWnd, 'uint', $iMsg, 'wparam', $wParam, 'lparam', $lParam)[0] EndFunc ;==>__WinAPI_DefSubclassProc
-
to be or not to be 🤔 ..if you hide it after _GUIDarkTheme_ApplyDark() it will hide it but, if is before, it does not. Hence a check on the visibility of the control is needed for when applying the colors 🤔 For now maybe ... _GUIDarkTheme_ApplyDark($Form1) GUICtrlSetState($idProgressError, $GUI_HIDE) GUISetState(@SW_SHOW) ... until he thinkers with it. Thanks for being a good beta tester @xuankhanh1982 This is teaser: of what he's putting together
-
Pic control resize issue
argumentum replied to pixelsearch's topic in AutoIt General Help and Support
;Coded by UEZ build 2026-05-31 #include <Constants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global Const $STM_SETIMAGE = 0x0172 Global $sImage = "image.png" _GDIPlus_Startup() Global $hBmp = _GDIPlus_BitmapCreateFromFile($sImage), $hTexture = _GDIPlus_TextureCreate($hBmp, 0) Global $iW = _GDIPlus_ImageGetWidth($hBmp), $iH = _GDIPlus_ImageGetHeight($hBmp) Global $g_hWnd, $hGUI = GUICreate("Test", $iW, $iH, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_THICKFRAME), $WS_EX_COMPOSITED) Global $idPic = GUICtrlCreatePic("", 0, 0, $iW, $iH) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) Global $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) Global $hB = GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap) If $hB Then _WinAPI_DeleteObject($hB) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SIZE, "WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIRegisterMsg($WM_SIZE, "") _WinAPI_DeleteObject($hHBitmap) _GDIPlus_BrushDispose($hTexture) _GDIPlus_BitmapDispose($hBmp) _GDIPlus_Shutdown() GUIDelete() Exit EndSwitch WEnd Func WM_SIZE($hWnd, $Msg, $wParam, $lParam) #forceref $Msg, $wParam, $lParam $g_hWnd = $hWnd doit() AdlibRegister(doit, 100) Return "GUI_RUNDEFMSG" EndFunc Func doit() AdlibUnRegister(doit) Local $aSize = ControlGetPos($g_hWnd, "", $idPic) Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($aSize[2], $aSize[3]) Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetInterpolationMode($hContext, 0) _GDIPlus_GraphicsFillRect($hContext, 0, 0, $aSize[2], $aSize[3], $hTexture) _GDIPlus_GraphicsDispose($hContext) Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) Local $hB = GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap) If $hB Then _WinAPI_DeleteObject($hB) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_BitmapDispose($hBitmap) EndFunc ..to give it a last pass. Looks better on mouse release -
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <SendMessage.au3> #include <WinAPIsys.au3> #include <WindowsClassConstants.au3> Global Const $HKM_GETHOTKEY = 0x0402 Exit _example() Func _example() Local $bPowerModeActive, $hGUI = GUICreate("Hotkey control example", 380, 180, -1, -1, -1, BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUICtrlCreateLabel("Type your shortcut (e.g., Ctrl+W, Ctrl+Shift+Alt+K):", 20, 20, 340, 25) Local $hWndHotkey = _WinAPI_CreateWindowEx(0, $WC_HOTKEY, "", BitOR($WS_CHILD, $WS_VISIBLE), 20, 55, 200, 22, $hGUI) Local $idBtnApply = GUICtrlCreateButton("Apply Hotkey", 245, 54, 110, 24) Local $idChkPowerUser = GUICtrlCreateCheckbox("Power User Mode (Disable Warning Dialogs)", 20, 95, 340, 20) GUICtrlCreateLabel("---------------------------------------------------------------------------------", 20, 125, 340, 15) Local $idLblStatus = GUICtrlCreateLabel("Active Hotkey Hook: None", 20, 145, 340, 20) GUICtrlSetFont($idLblStatus, 10, 800) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() ExitLoop Case $idBtnApply $bPowerModeActive = (GUICtrlRead($idChkPowerUser) = $GUI_CHECKED) _SetNewHotkey($hWndHotkey, $idLblStatus, $bPowerModeActive, $hGUI) EndSwitch WEnd EndFunc ;==>_example Func _SetNewHotkey($hWndCtrl, $idStatusLabel, $bPowerMode, $hGUI) Local Static $sCurrentHotkey = "" Local $iHotkeyData = _SendMessage($hWndCtrl, $HKM_GETHOTKEY, 0, 0) Local $iKey = BitAND($iHotkeyData, 0xFF) Local $iModifiers = BitShift($iHotkeyData, 8) ConsoleWrite('- $iKey = "0x' & Hex($iKey, 2) & '" (' & $iKey & ')' & @CRLF) ConsoleWrite('- $iModifiers = "' & $iModifiers & '"' & @CRLF) If $iKey = 0 Then If $sCurrentHotkey <> "" Then HotKeySet($sCurrentHotkey) $sCurrentHotkey = "" EndIf GUICtrlSetData($idStatusLabel, "Active Hotkey Hook: None") MsgBox($MB_ICONINFORMATION, "Cleared", "Hotkey removed successfully.", 120, $hGUI) Return EndIf Local $iWin32Mod = 0 If BitAND($iModifiers, 1) Then $iWin32Mod += 1 ; Shift If BitAND($iModifiers, 2) Then $iWin32Mod += 2 ; Ctrl If BitAND($iModifiers, 4) Then $iWin32Mod += 4 ; Alt Local $bOsCheck = _WinAPI_RegisterHotKey(0, 999, $iWin32Mod, $iKey) If $bOsCheck Then _WinAPI_UnregisterHotKey(0, 999) Else MsgBox($MB_ICONERROR, "OS Hardware Blocked!", _ "The Windows OS kernel has permanently locked this specific key combination." & _ " It is fundamentally impossible to register.", 120, $hGUI) Return EndIf If Not $bPowerMode Then Local $bIsRisky = False Local $sReason = "" If ($iModifiers = 2) Then ; just Control Combo Switch $iKey Case 0x43 ; C $bIsRisky = True $sReason = "Global Copy Clipboard Command" Case 0x56 ; V $bIsRisky = True $sReason = "Global Paste Clipboard Command" Case 0x58 ; X $bIsRisky = True $sReason = "Global Cut Clipboard Command" Case 0x57 ; W $bIsRisky = True $sReason = "Standard Browser Window/Tab Close Utility" EndSwitch EndIf ; Catch single keys that have no modifiers (like standalone F1-F12 keys) If Not $iModifiers Then $bIsRisky = True If $iKey >= 112 And $iKey <= 123 Then $sReason = "Standalone Functional F" & ($iKey - 111) & " Key" Else $sReason = "Just a key without modifiers" EndIf EndIf If $bIsRisky Then Local $iChoice = MsgBox(BitOR($MB_YESNO, $MB_ICONWARNING, $MB_DEFBUTTON2, $MB_TOPMOST), "Warning: Overriding System Shortcut", _ "The shortcut you entered is typically mapped to: [" & $sReason & "]." & @CRLF & @CRLF & _ "Activating it globally will break its usage in other programs!" & @CRLF & @CRLF & _ "Do you want to override this safety constraint?", 120, $hGUI) If $iChoice <> $IDYES Then Return EndIf EndIf Local $sAutoItKeyString = "" If BitAND($iModifiers, 1) Then $sAutoItKeyString &= "+" If BitAND($iModifiers, 2) Then $sAutoItKeyString &= "^" If BitAND($iModifiers, 4) Then $sAutoItKeyString &= "!" Switch $iKey Case 112 To 123 ; F1 to F12 $sAutoItKeyString &= "{F" & ($iKey - 111) & "}" Case 8 ; Backspace $sAutoItKeyString &= "{BACKSPACE}" Case 9 ; Tab $sAutoItKeyString &= "{TAB}" Case 13 ; Enter $sAutoItKeyString &= "{ENTER}" Case 19 ; Pause $sAutoItKeyString &= "{PAUSE}" Case 20 ; Caps Lock $sAutoItKeyString &= "{CAPSLOCK}" Case 27 ; Escape $sAutoItKeyString &= "{ESC}" Case 32 ; Spacebar $sAutoItKeyString &= "{SPACE}" Case 33 To 40 ; Navigation block (PGUP, PGDN, END, HOME, LEFT, UP, RIGHT, DOWN) Local $aNav = ["PGUP", "PGDN", "END", "HOME", "LEFT", "UP", "RIGHT", "DOWN"] $sAutoItKeyString &= "{" & $aNav[$iKey - 33] & "}" Case 45 ; Insert $sAutoItKeyString &= "{INSERT}" Case 46 ; Delete $sAutoItKeyString &= "{DEL}" Case 96 To 105 ; Numpad 0 to 9 $sAutoItKeyString &= "{NUMPAD" & ($iKey - 96) & "}" Case 106 To 111 ; Numpad Operators (*, +, Separator, -, ., /) Local $aOps = ["NUMPADMULT", "NUMPADADD", "", "NUMPADSUB", "NUMPADDOT", "NUMPADDIV"] $sAutoItKeyString &= "{" & $aOps[$iKey - 106] & "}" Case 144 ; Num Lock $sAutoItKeyString &= "{NUMLOCK}" Case 145 ; Scroll Lock $sAutoItKeyString &= "{SCROLLLOCK}" ; ⚠️ OEM Symbol Mappings for standard hardware layouts ⚠️ Case 0xBA ; Semicolon / Plus key (; :) $sAutoItKeyString &= ";" Case 0xBB ; Plus key (= +) $sAutoItKeyString &= "=" Case 0xBC ; Comma key (, <) $sAutoItKeyString &= "," Case 0xBD ; Minus key (- _) $sAutoItKeyString &= "-" Case 0xBE ; Period key (. >) $sAutoItKeyString &= "." Case 0xBF ; Slash key (/ ?) $sAutoItKeyString &= "/" Case 0xC0 ; Tilde key (` ~) $sAutoItKeyString &= "`" Case 0xDB ; Open Bracket key ([ {) $sAutoItKeyString &= "[" Case 0xDC ; Backslash key (\ |) $sAutoItKeyString &= "\" Case 0xDD ; Close Bracket key (] }) $sAutoItKeyString &= "]" Case 0xDE ; Quote key (' ") $sAutoItKeyString &= "'" Case Else $sAutoItKeyString &= StringLower(Chr($iKey)) EndSwitch ConsoleWrite('- "' & $sAutoItKeyString & '"' & @CRLF) If $sCurrentHotkey <> "" Then HotKeySet($sCurrentHotkey) If HotKeySet($sAutoItKeyString, "_MyCustomAction") Then $sCurrentHotkey = $sAutoItKeyString GUICtrlSetData($idStatusLabel, "Active Hotkey Hook: " & $sAutoItKeyString) MsgBox(BitOR($MB_ICONINFORMATION, $MB_TOPMOST), "Success", "Registered: " & $sAutoItKeyString, 120, $hGUI) Else $sCurrentHotkey = "" GUICtrlSetData($idStatusLabel, "Active Hotkey Hook: None") MsgBox(BitOR($MB_ICONERROR, $MB_TOPMOST), "Hotkey Registration Blocked!", _ "Registration Failed! Another active background application or game has already claimed the [" & $sAutoItKeyString & "] shortcut.", 120, $hGUI) EndIf EndFunc ;==>_SetNewHotkey Func _MyCustomAction() MsgBox(BitOR($MB_ICONINFORMATION, $MB_TOPMOST), "Action Successful", "Macro combination intercepted and running your function", 2) EndFunc ;==>_MyCustomAction ..will not give you the commonly used "{ESC}" and some other keys, but we have the $WC_HOTKEY in WindowsClassConstants.au3 and no example on to how to use it. At least none that I found. Edit: it seems that I didn't search good enough ( /topic/96492-hotkey-control-udf-msctls_hotkey32/ , /forum/topic/176502-hot-key-control/ , etc. ) 😅
-
-
Need help subclassing checkbox control
argumentum replied to WildByDesign's topic in AutoIt GUI Help and Support
-
Need help subclassing checkbox control
argumentum replied to WildByDesign's topic in AutoIt GUI Help and Support
-
Need help subclassing checkbox control
argumentum replied to WildByDesign's topic in AutoIt GUI Help and Support
<Removed pics. Running out of space 🤷♂️ > -
Need help subclassing checkbox control
argumentum replied to WildByDesign's topic in AutoIt GUI Help and Support
<Removed pics. Running out of space 🤷♂️ > -
Need help subclassing checkbox control
argumentum replied to WildByDesign's topic in AutoIt GUI Help and Support
<Removed pics. Running out of space 🤷♂️ > -
ok, 1 down, 2 to go. The date controls as you can see are good but the drop down and the checkbox are not there yet for 24H2 ( but the example I gave you works 🤔 ) In 25H2 it is all working beautifully. Edit: only the checkbox still needs fixing for 24H2. I'll have to see what is doing what in my project. 😭
-
The GUICtrlCreateDate() don't behave well in 25H2, and in 24H2 is worse, with the GUICtrlCreateCheckbox() not changing the text color. ( from my project in 24H2 ) Edit: also "!>13:11:54 AutoIt3 ended. rc:-1073740771" on x86 and x64
-
Help File/Documentation Issues. (Discussion Only)
argumentum replied to guinness's topic in AutoIt Technical Discussion
ObjEvent ( "AutoIt.Error" [, "function"] ) ...If the second parameter is omitted, it will return a string containing the name of the current Error handler function. If no Error handler function has been set, it will return an empty string. If ObjEvent("AutoIt.Error") = "" And FuncName(ObjEvent("AutoIt.Error")) = "" Then $oMyError = ObjEvent("AutoIt.Error", MyProjectErrFunc) Should we add that if the function name is not a string we should check for the FuncName ? Since the help was written before the need to encapsulate the function as a string, ... . Maybe: it will return a string containing the name of the current Error handler function. and remove the "string" detail ? P.S.: ..the detail came up scripting zip-your-project-nicely and I had to think of why wasn't it returning a string.