17 Ocak 2012 Salı

Fareyi Koordinatlara Gönderme Kodu

Posted by Unknown On 13:11 No comments

Belki bir program yaparken işinize yarar diye düşündüm
bir tane command button ve bir tane de Shape daire (adını target yapın) ekleyin.

-----------------------------------------------------------------------------------

Option Explicit

Private Type POINTAPI
x As Long
y As Long
End Type

Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long

Sub MoveMouse(x As Single, y As Single)
Dim pt As POINTAPI

pt.x = x
pt.y = y
ClientToScreen hwnd, pt
SetCursorPos pt.x, pt.y
End Sub

Private Sub Command1_Click()
MoveMouse Target.Left + Target.Width / 2, _
Target.Top + Target.Height / 2
End Sub

0 yorum:

Yorum Gönder