|
-
Jul 15th, 2001, 12:04 AM
#1
Mouse (x,y)
I want to set the mouse pos (x,y)at a pixel with color .
Module :
Option Explicit
Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Declare Function SetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Type POINTAPI
x As Long
y As Long
End Type
Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Form:
Private Sub GO_Click()
Dim dc, pnt As POINTAPI, str As String, colr
pnt.x = x
pnt.y = y
dc = GetDC(0)
If GetPixel(dc, pnt.x, pnt.y) = RGB(255, 255, 255) Then
SetCursorPos pnt
End If
End Sub
I know that not working because I think I need to do a loop for the x one ranges from 0 to screen.width \ screen.twipsperpixelX and for the the y one ranges from 0 to screen.height \ screen.twipsperpixely.
But I never found how to do it yet. If some one can help me please reply.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|