pixelcolor
?
비활성창 내에서(최소화가 되지 않은상태) 지정좌표의 픽셀값을 얻는 명령어
?
사용볍
?
변수:=pixelcolor(비활성창내x좌표, 비활성창내y좌표, 비활성창ID)
?
스크립------------------------------------------------
?
winget, ID,ID, wintitle
result:=pixelcolor(x,y, ID)
msgbox, %result%
return
?
--------------------------------------------------------
?
이렇게만 쓰면 핫키 실행시 존재하지 않는 명령어라 나옵니다.
?
스크립 내에 밑에 함수를 넣어줘야 pixcelcolor라는 명령어를 쓸 수 있습니다.
?
?
PixelColor(pc_x, pc_y, pc_wID)
{
?If pc_wID
?{
??pc_hDC := DllCall("GetDC", "UInt", pc_wID)
??WinGetPos, , , pc_w, pc_h, ahk_id %pc_wID%
??pc_hCDC := CreateCompatibleDC(pc_hDC)
??pc_hBmp := CreateCompatibleBitmap(pc_hDC, pc_w, pc_h)
??pc_hObj := SelectObject(pc_hCDC, pc_hBmp)
??
??pc_hmCDC := CreateCompatibleDC(pc_hDC)
??pc_hmBmp := CreateCompatibleBitmap(pc_hDC, 1, 1)
??pc_hmObj := SelectObject(pc_hmCDC, pc_hmBmp)
??
??DllCall("PrintWindow", "UInt", pc_wID, "UInt", pc_hCDC, "UInt", 0)
??DllCall("BitBlt" , "UInt", pc_hmCDC, "Int", 0, "Int", 0, "Int", 1, "Int", 1, "UInt", pc_hCDC, "Int", pc_x, "Int", pc_y, "UInt", 0xCC0020)
??pc_fmtI := A_FormatInteger
??SetFormat, Integer, Hex
??DllCall("GetBitmapBits", "UInt", pc_hmBmp, "UInt", VarSetCapacity(pc_bits, 4, 0), "UInt", &pc_bits)
??pc_c := NumGet(pc_bits, 0)
??SetFormat, Integer, %pc_fmtI%
??DeleteObject(pc_hBmp), DeleteObject(pc_hmBmp)
??DeleteDC(pc_hCDC), DeleteDC(pc_hmCDC)
??DllCall("ReleaseDC", "UInt", pc_wID, "UInt", pc_hDC)
??Return pc_c
?}
}
CreateCompatibleDC(hdc=0)
{
?return DllCall("CreateCompatibleDC", "UInt", hdc)
}????
CreateCompatibleBitmap(hdc, w, h)
{
?return DllCall("CreateCompatibleBitmap", UInt, hdc, Int, w, Int, w)
}
SelectObject(hdc, hgdiobj)
{
?return DllCall("SelectObject", "UInt", hdc, "UInt", hgdiobj)
}
DeleteObject(hObject)
{
?? Return, DllCall("DeleteObject", "UInt", hObject)
}
DeleteDC(hdc)
{
?Return, DllCall("DeleteDC", "UInt", hdc)
}
http://www.autohotkey.com/board/topic/38414-pixelcolorx-y-window-transp-off-screen-etc-windows/
본문입니다.