Hi i'm trying to get the colour of pixel that is hidden behind other windows. I've tried the test code in this thead and it works when i switch to aero theme. But for some reason I cant get it to work. Must be miss applying something somewhere. Any Ideas?
Code:
a::
WinGet, active_id, ID, A
pc_wID = ahk_id %active_id%
colour := PixelColor(20, 386, pc_wID)
PixelGetColor, OutputVar, 20, 386
MsgBox, newfunction : %colour% Built in: %OutputVar%
return
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 := DllCall("CreateCompatibleDC", "UInt", pc_hDC)
pc_hBmp := DllCall("CreateCompatibleBitmap", "UInt", pc_hDC, "Int", pc_w, "Int", pc_h)
pc_hObj := DllCall("SelectObject", "UInt", pc_hCDC, "UInt", pc_hBmp)
DllCall("PrintWindow", "UInt", pc_wID, "UInt", pc_hCDC, "UInt", 0)
pc_fmtI := A_FormatInteger
SetFormat, IntegerFast, Hex
pc_c := DllCall("GetPixel", "UInt", pc_hCDC, "Int", pc_x, "Int", pc_y, "UInt")
pc_c := pc_c >> 16 & 0xff | pc_c & 0xff00 | (pc_c & 0xff) << 16
pc_c .= ""
SetFormat, IntegerFast, %pc_fmtI%
DllCall("DeleteObject", "UInt", pc_hBmp)
DllCall("DeleteDC", "UInt", pc_hCDC)
DllCall("ReleaseDC", "UInt", pc_wID, "UInt", pc_hDC)
;MsgBox, colour: %pc_c%
Return pc_c
}
}