|
-
May 2nd, 2006, 04:10 AM
#1
Thread Starter
Addicted Member
Sending Mouse Click to App.
Hey I am trying to send Mouse Click Commands to One Appication without moving the Mouse Cursor.
I know that all appications get commands from Windows and then WndProc screens the messages and reacted to them.
Question is how do i inplant a message into one Appication's WndProc.
I was thinking a Virtual Mouse of sometype.
Thanks
P.S My Function Prototype needs to be like this
VB Code:
Public Function SendAPPClick( AppWinNum as HWnd, Clickx as Integer, Clicky as Integer )
'SEND FAKE MOUSE Y POSITION
'SEND FAKE MOUSE X POSITION
'SEND FAKE MOUSE LEFT CLICK
End Function
-
May 2nd, 2006, 05:12 AM
#2
Addicted Member
Re: Sending Mouse Click to App.
I don't know how you would send a mouse click without moving cursor, but you can move mouse, send click, then move back to original coordinates. Look at MouseMove.
VB Code:
Public Type POINTAPI
X As Long
Y As Long
End Type
Public Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Public Declare Function GetCursorPos Lib "user32" (lppoint As POINTAPI) As Long
Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_MIDDLEDOWN = &H20
Public Const MOUSEEVENTF_MIDDLEUP = &H40
Public Const MOUSEEVENTF_RIGHTDOWN = &H8
Public Const MOUSEEVENTF_RIGHTUP = &H10
Public Const MOUSEEVENTF_MOVE = &H1
Public lp As POINTAPI
'''MOUSE EVENTS'''
Public Sub LeftClick()
LeftDown
LeftUp
End Sub
Public Sub LeftDown()
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
End Sub
Public Sub LeftUp()
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
Public Sub MiddleClick()
MiddleDown
MiddleUp
End Sub
Public Sub MiddleDown()
mouse_event MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0
End Sub
Public Sub MiddleUp()
mouse_event MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0
End Sub
Public Sub MoveMouse(xMove As Long, yMove As Long)
GetCursorPos lp
mouse_event MOUSEEVENTF_MOVE, xMove, yMove, 0, 0 'MoveMouse
LeftDown 'Down
LeftUp 'Up
mouse_event MOUSEEVENTF_MOVE, lp.x, lp.y, 0, 0 'Move back to original coordinates
End Sub
Public Sub RightClick()
RightDown
RightUp
End Sub
Public Sub RightDown()
mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
End Sub
Public Sub RightUp()
mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
End Sub
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
|