-
Hello All,
I need a little hand in helping me to build something using a GetCursorPos Api. What Its gonna do is when the mouse clicks it will Put the cursor in a variable. But when I try to do this it screwed up, and it wont allow me to store the Variable info.
What I tried was this...
Dim IntCurPosNEW as long
IntCurPosNEW = GetCursorPos point
But when It did that it came up with a syntax error..
Anyhelp???
Thankyou much,
Evan
-
Code:
Type POINTAPI
x As long
y As Long
End Type
Private Sub Command1_Click()
Dim z As POINTAPI
Call GetCursorPos(z)
MsgBox "X = " & z.x & vbCrLf & "Y = " & z.y
End Sub
That code is untested.
------------------
Tom Young, 14 Year Old
[email protected]
ICQ: 15743470 Add Me ICQ Me
AIM: TomY10
PERL, JavaScript and VB Programmer
-
take a look at This great site for VB usage examples and explanations.
------------------
Marty
-
GetCursorPos Function
Declare Function GetCursorPos Lib "user32.dll" (lpPoint As POINT_TYPE) As Long
GetCursorPos reads the current position of the mouse cursor. The x and y coordinates of the cursor (relative to the screen) are put into the variable passed as lpPoint. The function returns 0 if an error occured or 1 if it is successful.
lpPoint
Receives the x and y coordinates of the mouse cursor.
Example:
' Display the coordinates of the mouse cursor
Dim coord As POINT_TYPE ' receives coordinates of cursor
Dim retval As Long ' return value
retval = GetCursorPos(coord) ' read cursor location
Debug.Print "The mouse is at:"; coord.x; coord.y