WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Display

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Get Screen Pixel Color

Keywords: 	 Get Screen Pixel Color GetPixel

gdidll=StrCat(DirWindows(1),"GDI32.DLL")
userdll=StrCat(DirWindows(1),"USER32.DLL")
hdc=DllCall(userdll,long:"GetDC",lpnull)
BoxOpen("PixelInfo","")

while 1
  mouse=MouseInfo(3)
  x=ItemExtract(1,mouse," ")
  y=ItemExtract(2,mouse," ")
  pixel=DllCall(gdidll,long:"GetPixel",long:hdc,long:x,long:y)

  Red = (pixel) & 255
  Green=(pixel >> 8) & 255
  Blue=(pixel >> 16) & 255
  BoxText(strcat("X=",x,@crlf,"Y=",y,@crlf,"Pixel=",red," ",green," ",blue))
  TimeDelay(1)
endwhile

:CANCEL
DllCall(userDLL,long:"ReleaseDC",lpnull,long:hdc)
Message("OK","On Exit")

Article ID:   W14581
Filename:   GetScreen Pixel color.txt
File Created: 2000:11:14:11:27:04
Last Updated: 2000:11:14:11:27:04