Ошибка-обнаружена ошибка AutoHotKey 64.... и вес комп уходит в дикие тормоза , да так , что до снятие процесса через диспетчер дойти нереально и лечится перезагрузкой системы..
#Include gdip_All.ahk
Width :=1920
Height := 1080
DiameterColor := 0xff00ff00 ; цвет диаметра
DiameterThickness := 2 ; толщина диаметра
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
oGraph := new Graphics(0, 0, Width, Height)
~^LButton::
if m!=2
{
MouseGetPos, X1, Y1
x1 := X1
y1 := Y1
m=2
exit
}
if m!=1
{
MouseGetPos, X2, Y2
x2 := X2
y2 := Y2
m=1
w1:=Abs(x2-x1)
h1:=Abs(y2-y1)
X:=x1, Y:=y1, W:=w1, H:=h1
If !pToken := Gdip_Startup()
Throw "Ошибка GDI+! Убедитесь в наличии gdiplus.dll в вашей системе!"
chdc := CreateCompatibleDC(), hbm := CreateDIBSection(w, h, chdc)
obm := SelectObject(chdc, hbm), hhdc := GetDC()
BitBlt(chdc, 0, 0, w, h, hhdc, x, y, 0x40000000|0x00CC0020)
ReleaseDC(hhdc), FileName := "d:\s1.png"
pBitmap := Gdip_CreateBitmapFromHBITMAP(hbm)
SelectObject(chdc, obm), DeleteObject(hbm), DeleteDC(hhdc), DeleteDC(chdc)
Gdip_SaveBitmapToFile(pBitmap, FileName), Gdip_DisposeImage(pBitmap), Gdip_Shutdown(pToken)
Gui, +LastFound +ToolWindow -Caption +AlwaysOnTop
Gui, Color, 354EA3
Gui, Show, x%X% y%Y% w%W% h%H% NA
WinSet, Transparent, 130
sleep 500
Gui, Hide
xz:=X
yz:=Y
;~ESC::Exit
sleep 3000
ImageSearch, xF, yF, 100, 100, 1720, 900, *TransBlack *n250 *wn-1 *hn-1 *40 d:\s1.png
MsgBox % "Найдено" xF "х" yF "предыдущие " xz "х" yz
;sleep 5000
}
class Graphics
{
__New(GuiX, GuiY, Width, Height) {
static WS_EX_LAYERED := 0x80000, WS_EX_TRANSPARENT := 0x20
Pi := 4*(4*ATan(1/5) - ATan(1/239))
this.Gr := Pi/180
this.Width := Width
this.Height := Height
this.pToken := Gdip_Startup()
Gui, Graphics:Default
Gui, % "-Caption +E" WS_EX_LAYERED " +ToolWindow +AlwaysOnTop +hwndhGui -DPIScale"
this.hGui := hGui
Gui, Show, NA x%GuiX% y%GuiY% w%Width% h%Height%
this.GraphicObjects := []
this.CreateNewGraphicObj(Width, Height)
}
__Delete() {
this.GraphicObjects := ""
Gdip_Shutdown(this.pToken)
}
__Get(key) {
if RegExMatch(key, "i)(G|hdc)(\d+)", match)
Return this.GraphicObjects[match2][match1]
}
CreateNewGraphicObj(Width, Height) {
GrObj := new this.NewGraphicObj(Width, Height)
Return this.GraphicObjects.Push(GrObj)
}
DrawDiameter(color, thickness,x1, y1, x2, y2) {
Gdip_GraphicsClear(this.G1, ARGB=0x00ffffff)
Gr := this.Gr
pPen := Gdip_CreatePen(color, thickness)
Gdip_DrawLine(this.G1, pPen, x1, y1, x2, y2)
Gdip_DeletePen(pPen)
UpdateLayeredWindow(this.hGui, this.hdc1)
}
DrawCircle(color, CX, CY, R) {
pBrush := Gdip_BrushCreateSolid(color)
Gdip_FillEllipse(this.G1, pBrush, CX, CY , 2*R, 2*R)
Gdip_DeleteBrush(pBrush)
UpdateLayeredWindow(this.hGui, this.hdc1)
}
class NewGraphicObj
{
__New(Width, Height) {
this.hbm := CreateDIBSection(Width, Height)
this.hdc := CreateCompatibleDC()
this.obm := SelectObject(this.hdc, this.hbm)
this.G := Gdip_GraphicsFromHDC(this.hdc)
Gdip_SetSmoothingMode(this.G, 4)
}
__Delete() {
SelectObject(this.hdc, this.obm), DeleteObject(this.hbm)
DeleteDC(this.hdc), Gdip_DeleteGraphics(this.G)
}
}
}