Kako da saznam trenutne koordinate kursora (X,Y) ?
Polozaj kursora.
Zaključano
Zakačeno
stavi na formu jedan tajmer (Timer1, podesi mu interval koji oces i stavi Enabled = True) i prekopiraj ovaj kod:
Code:
Private Type Point
X As Long
Y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (ByRef lpPoint As Point) As Long
Private Sub Timer1_Timer
Dim pt As Point
GetCursorPos pt
Debug.Print pt.x, pt.y
End Sub
Private Type Point
X As Long
Y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (ByRef lpPoint As Point) As Long
Private Sub Timer1_Timer
Dim pt As Point
GetCursorPos pt
Debug.Print pt.x, pt.y
End Sub
Ako pitas za polozaj kursora na datoj formi onda stavi ovo na tu formu pa probaj:
Ako zelis da dobije polozaj kursora na ekranu onda:
E pretekao si me :)
Code:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Debug.Print X
Debug.Print Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Debug.Print X
Debug.Print Y
End Sub
Ako zelis da dobije polozaj kursora na ekranu onda:
Code:
Option Explicit
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Dim Point As POINTAPI
GetCursorPos Point
Debug.Print Point.X
Debug.Print Point.Y
End Sub
Option Explicit
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Dim Point As POINTAPI
GetCursorPos Point
Debug.Print Point.X
Debug.Print Point.Y
End Sub
E pretekao si me :)
Potpis
SELECT * FROM หน่วยงานหลัก WHERE ยสันติ LIKE 'โดย%'