The routine I have below I want to get the pixel of the screen. It returns nothing here. If I move the GetPixel call out of the loop, it returns something.
Any idea what I'm doing wrong or a better way of this?
Thanks!
VB Code:
Private Sub Command1_Click() Dim hDC As Long Dim H1 As Long Dim W1 As Long Dim Z As Long H1 = Screen.Height / Screen.TwipsPerPixelY W1 = Screen.Width / Screen.TwipsPerPixelX Dim X As Long Dim Y As Long hDC = GetDC(0) 'get desktop dc For Y = 1 To Y1 - 10 For X = 1 To H1 - 10 Z = GetPixel(hDC, X, Y) Memo1.Text = Memo1.Text & Trim(Str(Z)) Next X Next Y End Sub




Reply With Quote