Kode ini berguna untuk melihat posisi mouse di layar Monitor
Buatlah form dengan :
- 2 Buah text
- 1 Buah timer (interval=1)
coding ini di bagian Declarations :
Private Declare Function GetCursorPos Lib "user32.dll" (ByRef lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Function ClientToScreen Lib "user32.dll" (ByVal hwnd As Long, ByRef lpPoint As POINTAPI) As Long
Private 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 Function ClientToScreen Lib "user32.dll" (ByVal hwnd As Long, ByRef lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Untuk mendapatkan posisi mouse coding di Bagian Timer1_timer
Dim p As POINTAPI
GetCursorPos p
Text1.Text = p.x
Text2.Text = p.y
GetCursorPos p
Text1.Text = p.x
Text2.Text = p.y






0 comment:
Posting Komentar