本帖最后由 microzhou 于 2023-5-18 16:59 编辑
控制浏览器看了两天还是不大明白,最后直接截屏取色搞定,暂时先这样用着,谢谢各位的帮助!#include <GDIPlus.au3>
#include <ScreenCapture.au3>
Local $hGUI,$x,$y
$x = 3
$y = 3
; 创建 GUI
;$hGUI = GUICreate("Screen Capture", 110, 10)
WinActivate("Google Chrome")
WinSetState("Google Chrome", "", @SW_MAXIMIZE)
Sleep(500)
$hGUI = GUICreate("Screen Capture", 110, 10, 1315, 405)
; 捕获窗口
_ScreenCapture_CaptureWnd(@DesktopDir & "\clipboard.png", $hGUI)
; 从档案中建立一个 GDI+ 图像物件
_GDIPlus_Startup()
$bitmap = _GDIPlus_BitmapCreateFromFile(@DesktopDir & "\clipboard.png")
$graphics = _GDIPlus_ImageGetGraphicsContext($bitmap)
; 获取指定坐标的颜色值
$color = _GDIPlus_BitmapGetPixel($bitmap, $x, $y)
;ConsoleWrite("颜色值:0x" & Hex($color, 6) & @CRLF)
MsgBox(0, "", "颜色值:0x" & Hex($color, 6) & @CRLF)
; 清理资源
_GDIPlus_GraphicsDispose($graphics)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_Shutdown()
|