Using GetPixel on entire screen?
Is there any way to use GetPixel on the screen no matter what programs are shown or desktop? GetPixel needs the handle as the parameter. I just want to know the color of anywhere that is shown on the screen no matter what program it is and not worry about the handle.
Is this possible?
Thanks
Re: Using GetPixel on entire screen?
VB Code:
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Command1_Click()
Dim dhwnd As Long
Dim dhdc As Long
Dim color As Long
Dim x As Long
Dim y As Long
dhwnd = GetDesktopWindow
dhdc = GetWindowDC(dhwnd)
color = GetPixel(dhdc, x, y)
End Sub