Ok, so I'm getting the color of a pixel on my desktop with this code:
Is it possible to get the pixel from an hDC/hWnd instead? Like doing this first:
I think the code's right, I can't open VS right now, so I typed it from memory. :)
Code:
Private Function GetScreenPixel(ByVal PT As Point) As Color
Dim Pixel As Bitmap = New Bitmap(1, 1)
Dim GFX As Graphics = Graphics.FromImage(Pixel)
GFX.CopyFromScreen(PT, Point.Empty, New Size(1, 1))
Dim BMD As BitmapData = Pixel.LockBits(New Rectangle(0, 0, 1, 1), ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb)
Dim ARGB As Int32 = Marshal.ReadInt32(BMD.Scan0, 0)
End Function
Code:
Dim hWnD As IntPtr = FindWindow(vbnullstring,"Window Title")