01-15-2005, 08:37 PM
Im soffy for wasteing your time, but how can I scan the whole screen for a certian pixel RGB, Not just an x,y pixel cordinate. And when I meen scan, I meen when the user presses print screen
(copys screen to clipboard). I want to be able to scan the clipboard image for a certian pixel basically. And again, im sorry for this difficult question, if I get no responses, ill understand :(.
01-16-2005, 03:35 AM
That code should do it. unfortunately the getpixel/point does only return a value for the part of the picturebox which is visible.
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Sub Form_Load()
PIC.ScaleMode = 3
Private Sub Timer_Timer()
Dim i As Long, ii As Long
If GetAsyncKeyState(vbKeySnapshot) Then
Set PIC.Picture = Clipboard.GetData(2)
For i = 0 To PIC.ScaleWidth
For ii = 0 To PIC.ScaleHeight
If PIC.Point(i, ii) = 0 Then Debug.Print i & " " & ii
01-16-2005, 07:22 PM
This isnt working :(. Can someone provide more sample code?
01-16-2005, 11:29 PM
So you've a copy of the screen shot already, then use GetDIBits to get the image data to a byte array. Then scan the byte array for the required pixel.
01-22-2005, 12:23 AM
Can you provide code on how to do this, Im really sorry for giving you guys a hard time :(
01-22-2005, 12:27 AM
What are you trying to accomplish? And to clarify, you want to search for a specific RGB value? Do you just need to know YES/NO whether the color exists on the screen or in a particular window?
01-22-2005, 01:41 AM
Im trying to scan screen from data in clipboard from print screen. And yes im scanning for a certian pixel, it doesnt have to be at a certian X,Y cordinate. Its the screen, not a window.
01-23-2005, 01:06 AM
You must've meant that you want to scan for a certain pixel and give back its x, y location. But doesn't it take time?