- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我无法在放大镜上添加十字准线。 This我的源代码是基于:
#include <GUIConstants.au3>
$MagWidth = 50
$MagHeight = 50
$MagZoom = 3
Global $dll[3], $DeskHDC, $GUIHDC
$dll[1] = DllOpen ( "user32.dll")
$dll[2] = DllOpen ( "gdi32.dll")
Global $GUI = GUICreate ("Zoom x2 Au3", $MagWidth * $MagZoom, $MagHeight * $MagZoom, _
MouseGetPos (0), MouseGetPos (1), $WS_POPUP+$WS_BORDER, $WS_EX_TOPMOST)
Global $divider_x = GUICtrlCreateGraphic(5,25,$MagWidth * $MagZoom,1)
GUISetState(@SW_SHOW)
Global $LastPos[2] = [0,0]
While 1
MAG()
$MousePos = MouseGetPos()
If ($LastPos[0] <> $MousePos[0] Or $LastPos[1] <> $MousePos[1]) Then
WinMove("Zoom x2 Au3", "", $MousePos[0] + $MagWidth/2 + 5, $MousePos[1])
$LastPos[0] = $MousePos[0]
$LastPos[1] = $MousePos[1]
EndIf
Sleep(10)
WEnd
Func MAG()
$DeskHDC = DLLCall("user32.dll","int","GetDC","hwnd",0)
$GUIHDC = DLLCall("user32.dll","int","GetDC","hwnd",$GUI)
If Not @error Then
DLLCall("gdi32.dll", "int", "StretchBlt", "int", $GUIHDC[0], "int", _
0, "int", 0, "int", $MagWidth * $MagZoom, "int", $MagHeight * $MagZoom, "int", $DeskHDC[0], "int", _
MouseGetPos (0) - $MagWidth/2, "int", MouseGetPos (1) - $MagHeight/2, "int", $MagWidth ,"int", $MagHeight, _
"long", $SRCCOPY)
DLLCall("user32.dll","int","ReleaseDC","int",$DeskHDC[0],"hwnd",0)
DLLCall("user32.dll","int","ReleaseDC","int",$GUIHDC[0],"hwnd",$GUI)
EndIf
EndFunc
Func OnAutoItExit()
DllClose ( $dll[1] )
DllClose ( $dll[2] )
EndFunc
我尝试使用 GUICtrlCreateGraphic()
和 GUICtrlCreateLabel()
添加细线,但这只会减少 GUI 窗口上的放大显示。如何添加十字准线?
最佳答案
这里我给你展示一个解决方案,我已经做了一些时间:
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <StructureConstants.au3>
OnAutoItExitRegister('OnAutoItExit')
Global $iMagZoom = 5
Global $iMagWidth = Ceiling(100/$iMagZoom)
Global $iMagHeight = Ceiling(100/$iMagZoom)
Global $hDCDesk, $hDCZoom, $hPen
Global $hUser32 = DllOpen("user32.dll")
Global $hGDI32 = DllOpen("gdi32.dll")
Global $__hMouseProc = DllCallbackRegister("_MouseProc", "long", "int;wparam;lparam")
Global $__hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($__hMouseProc), _WinAPI_GetModuleHandle(0))
Global $hCross = GUICreate('', 48, 48, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
WinSetTrans($hCross, '', 10)
GUISetCursor(3, 1, $hCross)
Global $hZoom = GUICreate("Zoom Window", $iMagWidth * $iMagZoom, $iMagHeight * $iMagZoom, _
MouseGetPos(0), MouseGetPos(1), $WS_POPUP+$WS_BORDER, $WS_EX_TOPMOST)
GUISetState(@SW_SHOW, $hCross)
GUISetState(@SW_SHOW, $hZoom)
; once at start, than from mouse-callback-function
_Magnify()
While 1
Sleep(10)
WEnd
Func _ende() ; called by mouse left click
Exit
EndFunc
Func _Magnify($_iX=-1, $_iY=-1)
Local Static $fInit = True
If $fInit Then
$fInit = False
$hDCDesk = (DLLCall($hUser32, "int", "GetDC", "hwnd", 0))[0]
$hDCZoom = (DLLCall($hUser32, "int", "GetDC", "hwnd", $hZoom))[0]
$hPen = (DLLCall($hGDI32, "int", "CreatePen", "int", 0, "int", 3, "int", 0x00800000))[0] ; 0=PS_SOLID, dark-blue (0x00BBGGRR)
DLLCall($hGDI32, "int", "SelectObject", "int", $hDCZoom, "hwnd", $hPen)
$_iX = MouseGetPos(0)
$_iY = MouseGetPos(1)
EndIf
Local $iW = $iMagWidth * $iMagZoom, $iH = $iMagHeight * $iMagZoom
If Not @error Then
DLLCall($hGDI32, "int", "StretchBlt", "int", $hDCZoom, "int", _
0, "int", 0, "int", $iW, "int", $iH, "int", $hDCDesk, "int", _
$_iX - $iMagWidth/2, "int", $_iY - $iMagHeight/2, "int", $iMagWidth ,"int", $iMagHeight, _
"long", $SRCCOPY)
; draw the crosshair
_GDI32_DrawLine($hDCZoom, ($iW/2)-2, $iH/8, ($iW/2)-2, 3*($iH/8), $hGDI32) ; vertical
_GDI32_DrawLine($hDCZoom, ($iW/2)-2, 5*($iH/8), ($iW/2)-2, 7*($iH/8), $hGDI32) ; vertical
_GDI32_DrawLine($hDCZoom, $iW/8, ($iH/2)-2, 3*($iW/8), ($iH/2)-2, $hGDI32) ; horicontal
_GDI32_DrawLine($hDCZoom, 5*($iW/8), ($iH/2)-2, 7*($iW/8), ($iH/2)-2, $hGDI32) ; horicontal
EndIf
EndFunc
Func _GDI32_DrawLine(ByRef $_hDC, $_iX0, $i_Y0, $_iX1, $i_Y1, $_hDll=-1)
If $_hDll = -1 Then $_hDll = "gdi32.dll"
Local $tCurrent = DllStructCreate("struct; long X;long Y; endstruct")
DllCall($_hDll, "int", "MoveToEx", "int", $_hDC, "int", $_iX0, "int", $i_Y0, "ptr", DllStructGetPtr($tCurrent))
DllCall($_hDll, "int", "LineTo", "int", $_hDC, "int", $_iX1, "int", $i_Y1)
Return $tCurrent
EndFunc
Func _MouseProc($_nCode, $_wParam, $_lParam)
Local $tMSLLHOOKSTRUCT = DllStructCreate("struct; long X;long Y; endstruct; " & _
"DWORD mouseData; DWORD flags; DWORD time; ULONG_PTR dwExtraInfo;endstruct", $_lParam)
If $_nCode < 0 Then Return _WinAPI_CallNextHookEx($__hHook, $_nCode, $_wParam, $_lParam)
Local $iX = $tMSLLHOOKSTRUCT.X, $iY = $tMSLLHOOKSTRUCT.Y
Switch $_wParam
Case $WM_LBUTTONDOWN
_ende()
Case $WM_MOUSEMOVE
WinMove($hCross, "", $iX -24, $iY -24)
Local $iXz = ($iX +24 + $iMagWidth*$iMagZoom > @DesktopWidth) ? $iX -(24 + $iMagWidth*$iMagZoom) : $iX +24
Local $iYz = ($iY +24 + $iMagHeight*$iMagZoom > @DesktopHeight) ? $iY -(24 + $iMagHeight*$iMagZoom) : $iY +24
WinMove($hZoom, "", $iXz + $iMagWidth/2, $iYz)
_Magnify($iX, $iY)
EndSwitch
Return _WinAPI_CallNextHookEx($__hHook, $_nCode, $_wParam, $_lParam)
EndFunc
Func OnAutoItExit()
DLLCall($hUser32, "int", "ReleaseDC", "int", $hDCZoom, "hwnd", $hPen)
DLLCall($hUser32, "int", "ReleaseDC", "int", $hDCDesk, "hwnd", 0)
DLLCall($hUser32, "int", "ReleaseDC", "int", $hDCZoom, "hwnd", 0)
DllClose($hUser32)
DllClose($hGDI32)
_WinAPI_UnhookWindowsHookEx($__hHook)
DllCallbackFree($__hMouseProc)
EndFunc
关于autoit - 如何在放大镜上添加十字准线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44610862/
我可以使用什么函数来暂停 AutoIt 中的脚本? 我知道我可以像这样使用 sleep : Func TogglePause() $Paused = NOT $Paused While
我试图摆脱所有窗口上的最小化、最大化和关闭按钮。谷歌搜索我发现这个: $h = WinGetHandle("[CLASS:Notepad]") $iOldStyle = _WinAPI_GetWind
AutoIt FileCopy method定义以下返回值: Return Value Success: 1. Failure: 0. 显然,当文件复制操作失败时,我想告诉用户失败的原因。我如何获得这
我有两个文本框和一个按钮。如何在文本框中输入一个值,然后使用 AutoIt 按 Enter 按钮? 最佳答案 举个例子就这么简单: $gui = GUICreate("Test GUI", 640,
我想使用 AutoIt 将变量发送到 GUI 的编辑控件。如何从命令行或使用 shellexecute 运行我的 AutoIt 脚本,以便它正确处理其命令行参数? 我在 AutoIt 脚本中使用以下语
我想在 AutoIt 中编写一个脚本,它可以从键盘自动输入 A-Z,无需用户干预。 这可能吗? 最佳答案 您的程序不太可能需要捕获所有按键的所有输入。如果您确实需要这种用户输入,AutoIt 可能不适
我的 AutoIt 脚本发送一系列点击和按键来自动化旧的闭源应用程序。 它有错误,所以我想知道如何调试 AutoIt 脚本。或者至少输出脚本的行号(以显示实时执行的代码)。 最佳答案 How can
我有两个文本框和一个按钮。如何在文本框中输入一个值,然后使用 AutoIt 按 Enter 按钮? 最佳答案 举个例子就这么简单: $gui = GUICreate("Test GUI", 640,
我在看官方AutoIt Array Parameters ,据我所知,你必须告诉 AutoIt 你的数组有多少元素,然后才能创建它。由于我的数组将根据用户在我的界面中选择的内容而动态变化,因此我需要这
我试过下面的代码,但我得到的是空值 $myDefaultBrowser = RegRead("HKEY_CURRENT_USER\Software\Clients\StartMenuInternet"
这个问题在这里已经有了答案: How to press "Ctrl+Shift+Q" in AutoIt (2 个答案) 关闭 4 年前。 我是 AutoIt 的新手。我在 AutoIt 中使用以下
我希望模拟右键单击文件。这是通过打开 Windows 资源管理器窗口然后右键单击它来完成的。 主要问题是在 Windows 资源管理器中查找文件的位置。我目前使用的是 Autoit v3.3.8.1。
好的,哎呀,这里有语法转换问题...我该如何在 AutoIt 中执行此操作? String theStr = "Here is a string"; String theNewStr = ""; fo
如何获取菜单中当前选中的项目?例如在记事本中。如何识别当前选中的是不是“字体...” 提前致谢! ShellExecute("notepad.exe") WinWaitActive("Untitled
我正在尝试使用 AutoIt 自动化一个应用程序,我需要等待一个控件出现在应用程序中,然后才能开始自动化。此控件在应用程序启动后不久加载,但不会更改窗口标题。如何等待控件出现? 最佳答案 要获得另一个
有没有办法在新行上继续执行命令?我的 MsgBox() 函数调用很长,为了可读性,我想做这样的事情: $confirm = MsgBox(321, "Check Information", "Conf
我无法在放大镜上添加十字准线。 This我的源代码是基于: #include $MagWidth = 50 $MagHeight = 50 $MagZoom = 3 Global $dll[3],
我正在使用 AutoIt3,我需要一种方法让用户选择一个窗口。在我看来,最快的方法是让它们指向一个窗口。那么问题来了,如何查看鼠标指针下的窗口是什么? 最佳答案 我从我为选择屏幕上的区域而放置的一些代
注意,脚本文件名不算进参数,如果要获得脚本文件名请查看关于 @ScriptName 的说明。如果某个参数中包含有空格字符则必须用英文“双引号”把这个参数围住。已编译的
关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。 这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topi
我是一名优秀的程序员,十分优秀!