本帖最后由 tryhi 于 2010-12-9 20:50 编辑
lanfengc 前辈的屏幕放大镜-_ScreenCapture_Capture的应用的原理是截取鼠标周围的屏幕为图片之后进行放大之后,发现放大之后非常模糊,无法看清像素点,我重新修改了一下,原理是获取鼠标周围的屏幕颜色然后进行重组,这样是可以看清像素点,但获取一个20x20范围就要400次,效率低到完全不能,不知有没有那种方法可以放大到看清像素点效率又高的。#include <GUIConstants.au3>
Dim $pic[21][21]
$Form1 = GUICreate("放大镜-按'P'抓获", 203, 258, @DesktopWidth - 253, @DesktopHeight - 344)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
GUISetState(@SW_SHOW)
For $i = 1 To 20
For $j = 1 To 20
$pic[$i][$j] = GUICtrlCreateGraphic( ($i - 1) * 10, ($j - 1) * 10, 10, 10)
Next
Next
Opt("GUIOnEventMode", 1)
While 1
$MousePos=MouseGetPos()
For $i = 0 To 19
For $j = 0 To 19
$color = PixelGetColor(($MousePos[0]-10)+$i,($MousePos[1]-10)+$j)
GUICtrlSetBkColor($pic[$i+1][$j+1],$color)
Next
Next
WEnd
Func Close()
Exit
EndFunc ;==>Close
---------------------------------------------------------------------------------
已解决,解决方法如下Global $SRCCOPY = 0x00CC0020
Global $leave = 0
HotKeySet("{esc}","exit_x")
SplashTextOn ( "AU3MAG", "" , 100 , 100 , 0, 0, 1 )
$MyhWnd = WinGetHandle("AU3MAG")
While Not $leave
Sleep(25)
MAG()
WEnd
Func MAG()
$MyHDC = DLLCall("user32.dll","int","GetDC","hwnd",$MyhWnd)
If @error Then Return
$DeskHDC = DLLCall("user32.dll","int","GetDC","hwnd",0)
If Not @error Then
$xy = MouseGetPos()
If Not @error Then
$l = $xy[0]-10
$t = $xy[1]-10
DLLCall("gdi32.dll","int","StretchBlt","int",$MyHDC[0],"int",0,"int",0,"int",100,"int",100,"int",$DeskHDC[0],"int", $l,"int",$t,"int",20,"int",20,"long",$SRCCOPY)
EndIf
DLLCall("user32.dll","int","ReleaseDC","int",$DeskHDC[0],"hwnd",0)
EndIf
DLLCall("user32.dll","int","ReleaseDC","int",$MyHDC[0],"hwnd",$MyhWnd)
EndFunc
Func Exit_x()
Exit
EndFunc
|