önce aşağıdaki gibi tipleri tanımlarsın;
Public Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private 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)
Private Declare Function ClientToScreen Lib "user32" _
(ByVal hwnd As Long, lpPoint As POINTAPI) As Long
---------------------------------------------------------------------------
sonra form üzerindeki command1 adlı buttona farenin sol tuşuyla tıklamak için aşağıdaki kodu herhangi bir sub procedure içinde çalıştırırsın:[IMG]http://img.frmtr.com/images/smilies/biggrin.gif[/IMG]
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Dim pt As POINTAPI
pt.X = Command1.Width / 2
pt.Y = Command1.Height / 2
ClientToScreen Command1.hwnd, pt
SetCursorPos Pt.x, Pt.Y
Command1.SetFocus
mouse_event MOUSEEVENTF_LEFTDOWN, Command1.Width/2, Command1.Width/2, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN, Command1.Width/2, Command1.Width/2, 0, 0