Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/17/2024 in all areas

  1. Version 1.7.0 has just been released! Notable changes: Peek/Goto build-in function declarations now works (will open my mock included file) Include statements that fail to resolve will now be indicated with an error on that line Absolute paths for include statements now resolves New setting (autoit3.ignoreInternalInIncludes). When set to true, internal declarations (vars and funcs) within includes, will be ignored from completion suggestions I have not picked my goals for 1.8 yet, so please let me know here or on GitHub, if you have any wishes. The extension got it's first review on the visualstudio marketplace! So many thanks to Valentin for the glowing review! And a personal achivement of making my repository auto publish to the visualstudio marketplace and Open VSX, whenever i create a new release!
    3 points
  2. argumentum

    AutoIt Snippets

    Case $WM_NCHITTEST ; https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-nchittest ConsoleWrite(StringFormat("Button Hit. Mouse:[%d,%d]\r\n", BitAND($lParam, 0xFFFF), BitShift($lParam, 16))) Case $WM_MOUSELEAVE ; https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-mouseleave ConsoleWrite(StringFormat("Button Left") 0x02A3 is magic WM_MOUSELEAVE ..it was defined
    1 point
  3. Nine

    AutoIt Snippets

    Owner Draw Combo Box with default $CBS_DROPDOWN. Not so obvious as it seems. #include <WinAPIConv.au3> #include <WinAPIGdi.au3> #include <GUIConstants.au3> #include <Constants.au3> #include <GuiComboBox.au3> Opt("MustDeclareVars", True) Global Const $tagDRAWITEMSTRUCT = "uint CtlType;uint CtlID;uint itemID;uint itemAction;uint itemState;hwnd hwndItem;handle hDC;dword rcItem[4];ptr itemData" Global Const $ODA_DRAWENTIRE = 1 Global Const $ODS_SELECTED = 1 Global $idCombo Example() Func Example() GUICreate("Owner Draw", 300, 200) $idCombo = GUICtrlCreateCombo("", 10, 10, 185, 20, BitOR($CBS_HASSTRINGS, $CBS_OWNERDRAWFIXED, $GUI_SS_DEFAULT_COMBO)) Local $idClose = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUICtrlSetData($idCombo, "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17") GUISetState() Local $aAccelKeys[1][2] = [["{ENTER}", $idCombo]] GUISetAccelerators($aAccelKeys) GUIRegisterMsg($WM_COMMAND, WM_COMMAND) GUIRegisterMsg($WM_DRAWITEM, WM_DRAWITEM) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop EndSwitch WEnd EndFunc ;==>Example Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $idCtrl = _WinAPI_LoWord($wParam), $iCode = _WinAPI_HiWord($wParam) If $idCtrl = $idCombo And ($iCode = $CBN_KILLFOCUS Or $iCode = $CBN_SELCHANGE) Then Validate($idCtrl) Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func Validate($idComboBox) Local Static $sSelection Local $sComboRead = GUICtrlRead($idComboBox) If $sSelection = $sComboRead Then Return Local $iList = _GUICtrlComboBox_FindStringExact($idComboBox, $sComboRead) If $iList = -1 Then GUICtrlSendMsg($idComboBox, $CB_SETCURSEL, -1, 0) $sSelection = "" ConsoleWrite("Invalid data" & @CRLF) Else $sSelection = $sComboRead ConsoleWrite("Currently displaying: " & $sComboRead & @CRLF) If _GUICtrlComboBox_GetCurSel($idComboBox) = -1 Then _GUICtrlComboBox_SetCurSel($idComboBox, $iList) EndIf EndFunc ;==>Validate Func WM_DRAWITEM($hWnd, $iMsg, $wParam, $lParam) If $wParam <> $idCombo Then Return $GUI_RUNDEFMSG Local $tDraw = DllStructCreate($tagDRAWITEMSTRUCT, $lParam), $sText If $tDraw.itemAction = $ODA_DRAWENTIRE Then Local $tRECT = DllStructCreate($tagRECT, DllStructGetPtr($tDraw, "rcItem")) Local $hBrush = _WinAPI_CreateSolidBrush(BitAND($tDraw.itemState, $ODS_SELECTED) ? 0xFFCDAD : Mod($tDraw.itemID, 2) ? 0xFFFFFF : 0xE0E0E0) _WinAPI_FillRect($tDraw.hDC, $tRECT, $hBrush) $tRECT.Left += 5 $tRECT.Top += 2 _GUICtrlComboBox_GetLBText($tDraw.hwndItem, $tDraw.itemID, $sText) _WinAPI_DrawText($tDraw.hDC, $sText, $tRECT, $DT_LEFT) _WinAPI_DeleteObject($hBrush) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_DRAWITEM Note : you can tab, enter, up arrow, down arrow to validate the combo input field.
    1 point
  4. LAST VERSION - 1.1 18-May-12 Control Viewer (CV) is a replacement of AutoIt Window Info with a number of advantages. I tried to stick to the interface of the last, so you almost do not have to be retrained. During testing, I never managed to find any controls that could not be identified by CV (on the contrary, shows a lot of hidden controls, especially for the system windows). The all program settings are stored in the following registry key: HKEY_CURRENT_USERSoftwareY'sControl Viewer The main differences CV from AWI Shows the complete list of all existing controls for the window that are interested (visible, hidden and deleted controls are displayed with different colors that can be changed to any other).Dynamically changing information during search for the windows and their controls.Ability to quickly switch between controls in the list.Ability to show/hide any controls from the list (useful for the overlaping controls).Information for the Style and ExStyle parameters shown in the form of hexadecimal values​​, and as its flags.Added the PID and Path parameters in the Window tab and ability to quickly open a folder that containing the process file.Added the coordinate system relative to the selected control.Shows a color of the selected pixel in RGB and BGR formats.Shows an example fill of the selected color.Ability to select the text encoding (affects the Text parameter in the Control tab).The complete change the appearance of pop-up frame for the selected controls.Simple and convenient tool to get a screenshot of the part screen of interest for publication on the forum (Capture tab).Create a report in the clipboard or a text file for subsequent publication on the forum.Search all running AutoIt scripts and their windows in the system (AutoIt tab).User-friendly interface. Used shortcuts Ctrl+Alt+T - Enable/Disable "Always On Top" mode (also available from the menu). Ctrl+Alt+H - Enable/Disable highlight selected controls (also available from the menu). Ctrl+A - Select all text (works in any input field). Ctrl - Hold down when moving the mouse to scroll the screenshot (Capture tab). Shift - Hold down when stretching/compression of the contour frame for an equilateral resizing screenshots (Capture tab). DoubleClick (on the screenshot) - Save the image to a file (Capture tab). DoubleClick (on any list item) - Open a folder with the file of the process or AutoIt script (AutoIt tab). Del (on any list item) - Close process (AutoIt tab). F5 - Updating the list (AutoIt tab). If anyone have any questions or comments about CV, please post it in this thread. I will be glad to any feedback and suggestions. Files to download Binary (x86 and x64) Redirection to CV_bin.zip, 1.14 MB CV_bin.html Source Redirection to CV_source.zip, 691 KB CV_source.html
    1 point
  5. You need a sleep(10) before the WEnd in the tracking function at line 69, it's eating a whole core as it is now. Maybe also make it so the mouse can be moved in any direction, not just from left to right and from top to bottom, but also from right to left and bottom to top.
    1 point
  6. Okay, here is the final solution. Two windows. One window to draw on. Another window to block the mouse. 100% blocking mouse interactions with any underlying window. #include <GDIPlus.au3> #include <WindowsConstants.au3> HotKeySet("{ESC}", "End") ; DPI awareness Win10 & Win11 If @OSVersion = 'WIN_10' Or @OSVersion = 'WIN_11' Then DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext", "hwnd", -2) EndIf _GDIPlus_Startup() Local $hGUI = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) ; Main GUI Local $hBLK = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) ; Mouse Block GUI WinSetTrans($hBLK, "", 1) ; 0 = clicktrough | > 0 = Non clickthrough Local $hGDC = _WinAPI_GetDC($hGUI) Local $hMDC = _WinAPI_CreateCompatibleDC($hGDC) Local $hBit = _WinAPI_CreateCompatibleBitmap($hGDC, @DesktopWidth, @DesktopHeight) Local $hOld = _WinAPI_SelectObject($hMDC, $hBit) Local $hGFX = _GDIPlus_GraphicsCreateFromHDC($hMDC) Local $hPen = _GDIPlus_PenCreate(0xFF00FF00, 2) _GDIPlus_GraphicsSetSmoothingMode($hGFX, $GDIP_SMOOTHINGMODE_HIGHQUALITY) GUISetState(@SW_SHOW, $hBLK) GUISetState(@SW_SHOW, $hGUI) ; Pre-create structs outside the function if they do not change Global $tSize = DllStructCreate("int;int") Global $tPSrc = DllStructCreate("int;int") Global $tPDst = DllStructCreate("int;int") Global $tBlnd = DllStructCreate("byte;byte;byte;byte") ; Initialize constant values in the structs DllStructSetData($tSize, 1, @DesktopWidth) DllStructSetData($tSize, 2, @DesktopHeight) DllStructSetData($tBlnd, 3, 255) ; Alpha value 0-255 DllStructSetData($tBlnd, 4, 1) ; AC_SRC_ALPHA | Has Alpha = 1 | Has No Alpha = 0 While 1 StartMouseTracking($hGUI, $hGDC, $hMDC, $hGFX, $hPen) WEnd Func StartMouseTracking($hGUI, $hGDC, $hMDC, $hGFX, $hPen) Local $topLeft[2], $bottomRight[2], $aCall Local $isDragging = False While 1 $aCall = DllCall("user32.dll", "short", "GetAsyncKeyState", "int", 0x01) If BitAND($aCall[0], 0x8000) <> 0 Then ; Left mouse button is pressed down If Not $isDragging Then $topLeft[0] = MouseGetPos(0) $topLeft[1] = MouseGetPos(1) $isDragging = True Else ; Mouse is dragging Local $currentX = MouseGetPos(0) Local $currentY = MouseGetPos(1) If $currentX <> $bottomRight[0] Or $currentY <> $bottomRight[1] Then $bottomRight[0] = $currentX $bottomRight[1] = $currentY DrawRectangle($topLeft[0], $topLeft[1], $bottomRight[0], $bottomRight[1], $hGUI, $hGDC, $hMDC, $hGFX, $hPen) EndIf EndIf ElseIf $isDragging Then ; Left mouse button is released $isDragging = False ConsoleWrite($topLeft[0] & " " & $topLeft[1] & " " & $bottomRight[0] & " " & $bottomRight[1] & @LF) ExitLoop EndIf WEnd EndFunc ;==>StartMouseTracking Func DrawRectangle(ByRef $x1, ByRef $y1, ByRef $x2, ByRef $y2, ByRef $hGUI, ByRef $hGDC, ByRef $hMDC, ByRef $hGFX, ByRef $hPen) _GDIPlus_GraphicsClear($hGFX, 0x00000000) ; Clear with transparent background _GDIPlus_GraphicsDrawRect($hGFX, $x1, $y1, $x2 - $x1, $y2 - $y1, $hPen) DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $hGUI, "handle", $hGDC, "struct*", $tPDst, "struct*", $tSize, "handle", $hMDC, "struct*", $tPSrc, "dword", 0, "struct*", $tBlnd, "dword", 0x02) ; FAST _WinAPI_UpdateLayeredWindow $ULW_ALPHA = 0x02 EndFunc ;==>DrawRectangle Func End() _GDIPlus_PenDispose($hPen) ; Cleanup pen _GDIPlus_GraphicsDispose($hGFX) ; Cleanup graphics object _WinAPI_ReleaseDC($hGUI, $hGDC) ; Release device context _WinAPI_SelectObject($hMDC, $hOld) ; Restore the old object _WinAPI_DeleteObject($hBit) ; Delete the bitmap _WinAPI_DeleteDC($hMDC) ; Delete the memory device context _GDIPlus_Shutdown() ; Shutdown GDI+ GUIDelete($hGUI) ; Delete overlay window Exit EndFunc ;==>End @ioa747 Thanks man for the inspiration!
    1 point
×
×
  • Create New...