Visual Basic Mauszustand abfragen?
Hallo. Ich wollte fragen ob man in Visual Basic abfragen kann, ob die Maus gedrückt ist (geklickt halten) und das Ohne Form. Also z.B. Wenn ich in meinem Browser bin und as Programm läuft im Hintergrund, und dann abfragen (also das Formular ist im HIntergrund, Browser im Vordergrund)
Freue mich über schnelle Antworten
Vielen Dank!
2 Antworten
Von gutefrage auf Grund seines Wissens auf einem Fachgebiet ausgezeichneter Nutzer
Computer, Technik
Woher ich das weiß:Recherche
Von gutefrage auf Grund seines Wissens auf einem Fachgebiet ausgezeichneter Nutzer
programmieren
Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Form_Load()
Timer1.Interval = 250 ' less interval may cause performance issues
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
' Checking left mouse button.
If GetAsyncKeyState(1) = 0 Then
Me.Caption = "L up"
Else
Me.Caption = "L down"
End If
' ' Checking right mouse button.
' If GetAsyncKeyState(2) = 0 Then
' Me.Caption = "R up"
' Else
' Me.Caption = "R down"
' End If
End Sub
Woher ich das weiß:Studium / Ausbildung – Informatikstudent