schnullernase
Goto Top

GetCursorPos liefert immer 0

Ich will in VB2005 die Cursorposition abfragen.

Die Funktion GetCursorPos liefert immer 0, egal wohin ich die Maus bewege.

Die Deklaration:

Private Structure POINTAPI
Dim x As Int32
Dim y As Int32
End Structure

Private Declare Function GetCursorPos Lib "user32.dll" (ByVal lpPoint As POINTAPI) As Int32


Die Nutzung der Funktion:

Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
Dim CP As POINTAPI
GetCursorPos(CP)

TextBox1.Text = CP.x
TextBox2.Text = CP.y
End Sub

für die Werte CP.x und CP.y bekomme ich immer 0.

Kann mir jemand helfen?

Content-Key: 90523

Url: https://administrator.de/contentid/90523

Printed on: April 25, 2024 at 16:04 o'clock

Member: Logan000
Logan000 Jun 24, 2008 at 11:32:10 (UTC)
Goto Top
Moin

Warum nicht so?
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
  TextBox1.Text = e.x
  TextBox2.Text = e.y
End Sub

Gruß L.
Member: Schnullernase
Schnullernase Jun 24, 2008 at 11:40:41 (UTC)
Goto Top
Besten Dank, funktioniert super