AndyS19 Posted August 30, 2017 Share Posted August 30, 2017 I want to integrate a Finder Tool in my script, but while I see some old code, it makes use of the MySpy021.dll file which does not exist. I would like to provide a button like the Au3Info tool does. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 30, 2017 Moderators Share Posted August 30, 2017 AndyS19, Quote it makes use of the MySpy021.dll file which does not exist A 10-second search found the DLL in the zip file in this post: M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
AndyS19 Posted August 31, 2017 Author Share Posted August 31, 2017 I found the dll file here and ran the sample code. That left me with a script that shows some of the info that I need, but not for every control I hover over. My script sets a control to a certain Text and Background color. I want to use the Finder Tool to get the handle/id of the control. I would like to put the Finder Tool Icon in my script, but the icon that's supposed to be in ..Res\AutoItMacroGenerator2.ico does not exist. So I'm part way there. Andy Link to comment Share on other sites More sharing options...
AndyS19 Posted August 31, 2017 Author Share Posted August 31, 2017 I found some code here that builds the Find Tool icon on the fly. The sample code runs as a Finder Tool, but I don't see any change when moving from control to control. For instance, run the code wizard (directly, not from the 'tools' submenu) and drag the Finder Tool over the buttons and icons. Notice that the displayed info does not change. Here is the code I used from the site: expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstants.au3> #include <GuiStatusBar.au3> #include <StaticConstants.au3> #include <EditConstants.au3> #include <ColorConstants.au3> Global $CURSOR_TARGET = _WriteResource( _ "0x000002000100202000000F001000300100001600000028000000200000004000000001000100000000008000" & _ "00000000000000000000020000000200000000000000FFFFFF0000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "00000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" & _ "FFFFFFF83FFFFFE6CFFFFFD837FFFFBEFBFFFF783DFFFF7EFDFFFEAC6AFFFEABAAFFFE0280FFFEABAAFFFEAC6A" & _ "FFFF7EFDFFFF783DFFFFBEFBFFFFD837FFFFE6CFFFFFF83FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" & _ "FFFFFFFFFFFFFFFFFFFFFFFF") Global $ICON_TARGET_FULL = _WriteResource( _ "0x0000010001002020080000000000E80200001600000028000000200000004000000001000400000000000002" & _ "000000000000000000001000000010000000000000000000800000800000008080008000000080008000808000" & _ "00C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000000000000000" & _ "00000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFF" & _ "FFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFFFF000FFFFFFFFFF00FF0FF00FFFFFFFFFF000FF" & _ "FFFFFFF0FF00000FF0FFFFFFFFF000FFFFFFFF0FFFFF0FFFFF0FFFFFFFF000FFFFFFF0FFFF00000FFFF0FFFFFF" & _ "F000FFFFFFF0FFFFFF0FFFFFF0FFFFFFF000FFFFFF0F0F0FF000FF0F0F0FFFFFF000FFFFFF0F0F0F0FFF0F0F0F" & _ "0FFFFFF000FFFFFF0000000F0F0000000FFFFFF000FFFFFF0F0F0F0FFF0F0F0F0FFFFFF000FFFFFF0F0F0FF000" & _ "FF0F0F0FFFFFF000FFFFFFF0FFFFFF0FFFFFF0FFFFFFF000FFFFFFF0FFFF00000FFFF0FFFFFFF000FFFFFFFF0F" & _ "FFFF0FFFFF0FFFFFFFF000FFFFFFFFF0FF00000FF0FFFFFFFFF000FFFFFFFFFF00FF0FF00FFFFFFFFFF000FFFF" & _ "FFFFFFFF00000FFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF0" & _ "00FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000007770CCCCCCCCCCCCCCCCCCCC" & _ "C07770007070CCCCCCCCCCCCCCCCCCCCC07070007770CCCCCCCCCCCCCCCCCCCCC0777000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000FFFFFFFF8000000080000000800000008000000080000000800000008000000080000000" & _ "800000008000000080000000800000008000000080000000800000008000000080000000800000008000000080" & _ "0000008000000080000000800000008000000080000000800000008000000080000000FFFFFFFFFFFFFFFFFFFF" & _ "FFFF") Global $ICON_TARGET_EMPTY = _WriteResource( _ "0x0000010001002020080000000000E80200001600000028000000200000004000000001000400000000000002" & _ "000000000000000000001000000010000000000000000000800000800000008080008000000080008000808000" & _ "00C0C0C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF000000000000000000" & _ "00000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFF" & _ "FFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FF" & _ "FFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFF" & _ "F000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFF" & _ "FFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFF" & _ "FFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFF" & _ "FFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFF" & _ "FFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF0" & _ "00FFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000007770CCCCCCCCCCCCCCCCCCCC" & _ "C07770007070CCCCCCCCCCCCCCCCCCCCC07070007770CCCCCCCCCCCCCCCCCCCCC0777000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000FFFFFFFF8000000080000000800000008000000080000000800000008000000080000000" & _ "800000008000000080000000800000008000000080000000800000008000000080000000800000008000000080" & _ "0000008000000080000000800000008000000080000000800000008000000080000000FFFFFFFFFFFFFFFFFFFF" & _ "FFFF") ; Loading cursor from file $hTargetCursor = DllCall("User32.dll", "int", "LoadCursorFromFile", "str", $CURSOR_TARGET) $hTargetCursor = $hTargetCursor[0] $Quit = 0 Global $g_StartSearch = False, $gFoundWindow = 0, $gOldCursor $hGUI = GUICreate("Spy", 200, 280, -1, -1, -1, $WS_EX_TOPMOST) GUISetBkColor($COLOR_WHITE) GUICtrlCreateLabel("Y's SPY", 80, 20, 100, 100) GUICtrlSetFont(-1, 15, 900, 0, "Comic Sans MS") GUICtrlSetColor(-1, $COLOR_RED) GUICtrlCreateGroup("", 8, 0, 65, 65) $hTargetPic = GUICtrlCreateIcon($ICON_TARGET_FULL, 0, 24, 20, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP)) GUICtrlCreateGroup("", -99, -99, 1, 1) $Edit1 = GUICtrlCreateEdit("", 5, 90, 190, 150, $ES_WANTRETURN + $ES_READONLY) $hStatus = _GUICtrlStatusBar_Create($hGUI) GUISetState() GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE_FUNC") GUIRegisterMsg($WM_LBUTTONUP, "WM_LBUTTONUP_FUNC") While 1 $Msg = GUIGetMsg() Switch $Msg Case $hTargetPic $g_StartSearch = True DllCall("user32.dll", "hwnd", "SetCapture", "hwnd", $hGUI) $gOldCursor = DllCall("user32.dll", "int", "SetCursor", "int", $hTargetCursor) If Not @error Then $gOldCursor = $gOldCursor[0] GUICtrlSetImage($hTargetPic, $ICON_TARGET_EMPTY) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd $hWindow = $gFoundWindow Global $aWinPos = WinGetPos($hWindow) Func GetInfo($gFoundWindow) $Mouse = MouseGetPos() $mySpy = DllOpen("MySpy021.dll") ; DllOpen("MySpy.dll") If ($mySpy < 0) Then ConsoleWrite("+++: $mySpy = " & $mySpy & @CRLF) Return EndIf $PHWND = DllCall($mySpy, "hwnd", "AMG_GetPHWND", "long", $Mouse[0], "long", $Mouse[1]) $hWnd = DllCall($mySpy, "hwnd", "AMG_GetHWND", "long", $Mouse[0], "long", $Mouse[1]) $Classname = DllCall($mySpy, "str", "AMG_GetClassname", "long", $Mouse[0], "long", $Mouse[1]) $ClassCount = DllCall($mySpy, "long", "AMG_GetClassCount", "long", $Mouse[0], "long", $Mouse[1]) $WinTitle = DllCall($mySpy, "str", "AMG_GetWinTitle", "long", $Mouse[0], "long", $Mouse[1]) ; $WinTitle = WinGetTitle($gFoundWindow) $WinText = DllCall($mySpy, "str", "AMG_GetWinText", "long", $Mouse[0], "long", $Mouse[1]) ; $WinText = WinGetText($gFoundWindow) $WinClass = DllCall($mySpy, "str", "AMG_GetWinClass", "long", $Mouse[0], "long", $Mouse[1]) DllClose($mySpy) $data = 'Handle: ' & $hWnd[0] & @CRLF & 'Class: ' & $Classname[0] & @CRLF & 'Index: ' & $ClassCount[0] & @CRLF & 'Title: ' & $WinTitle[0] & @CRLF & 'Text: ' & $WinText[0] & @CRLF & 'Winclass: ' & $WinClass[0] GUICtrlSetData($Edit1, $data) _GUICtrlStatusBar_SetText($hStatus, $WinTitle[0]) EndFunc ;==>GetInfo Func WM_MOUSEMOVE_FUNC($hWnd, $nMsg, $wParam, $lParam) If Not $g_StartSearch Then Return 1 Local $mPos = MouseGetPos() $hWndUnder = DllCall("user32.dll", "hwnd", "WindowFromPoint", "long", $mPos[0], "long", $mPos[1]) If Not @error Then $hWndUnder = $hWndUnder[0] If _CheckFoundWindow($hWndUnder) Then ;GUICtrlSetData($hLabelTitle, WinGetTitle($hWndUnder)) ;GUICtrlSetData($hLabelWnd, $hWndUnder) ;GUICtrlSetData($hLabelClass, _GetWindowClass($hWndUnder)) $gFoundWindow = $hWndUnder GetInfo($gFoundWindow) EndIf Return 1 EndFunc ;==>WM_MOUSEMOVE_FUNC Func WM_LBUTTONUP_FUNC($hWnd, $nMsg, $wParam, $lParam) If Not $g_StartSearch Then Return 1 $g_StartSearch = False ; Release captured cursor DllCall("user32.dll", "int", "ReleaseCapture") DllCall("user32.dll", "int", "SetCursor", "int", $gOldCursor) GUICtrlSetImage($hTargetPic, $ICON_TARGET_FULL) ; MsgBox (0, "title", "text") ;msgbox(0,'',$WinTitle[0]) Return 1 EndFunc ;==>WM_LBUTTONUP_FUNC Func _CheckFoundWindow($hFoundWnd) If $hFoundWnd = $hGUI Then Return False If $hFoundWnd = 0 Then Return False If $hFoundWnd = $gFoundWindow Then Return False If Not WinExists($hFoundWnd) Then Return False Local $hTemp = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $hFoundWnd) If Not @error And $hTemp[0] = $hGUI Then Return False Return True EndFunc ;==>_CheckFoundWindow ;=============================================================================== ; Write icons and cursor ;=============================================================================== Func _WriteResource($sbStringRes) Local $sTempFile Do $sTempFile = @TempDir & "\temp" & Hex(Random(0, 65535), 4) Until Not FileExists($sTempFile) Local $hFile = FileOpen($sTempFile, 2 + 16) ; overwrite + binary FileWrite($hFile, $sbStringRes) FileClose($hFile) Return $sTempFile EndFunc ;==>_WriteResource 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