Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
Private Declare Sub mouse_event Lib "user32" _
(ByVal dwFlags As Long, ByVal dx As Long, _
ByVal dy As Long, ByVal cButtons As Long, _
ByVal dwExtraInfo As Long)
Private Const MOUSEEVENTF_ABSOLUTE = &H8000
Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
Private Const MOUSEEVENTF_MIDDLEUP = &H40
Private Const MOUSEEVENTF_MOVE = &H1
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10
Public Sub Mausklick(Optional Button As _
MouseButtonConstants = vbLeftButton, _
Optional AnzahlKlicks As Integer = 1, _
Optional XPos As Long = -1, _
Optional YPos As Long = -1)
Dim N As Integer
'Mauszeiger positionieren
If XPos <> -1 Or YPos <> -1 Then
mouse_event MOUSEEVENTF_ABSOLUTE + MOUSEEVENTF_MOVE, _
XPos / Screen.Width * 65535, _
YPos / Screen.Height * 65535, 0, 0
End If
'Mausklick simulieren
For N = 1 To AnzahlKlicks
Select Case Button
'linke Maustaste
Case vbLeftButton
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
'mittlere Maustaste
Case vbMiddleButton
mouse_event MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0
'rechte Maustaste
Case vbRightButton
mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
End Select
Next
End Sub
Private Declare Function GetAsyncKeyState Lib "user32" ( _
ByVal vKey As Long) As Integer
Private Const VK_LBUTTON = &H1
Private Const VK_RBUTTON = &H2
Private Const VK_MBUTTON = &H4
Private Sub Form_Load()
Timer1.Interval = 50
Timer1.Enabled = True
Call GetAsyncKeyState(VK_LBUTTON)
End Sub
Private Sub Timer1_Timer()
If GetAsyncKeyState(VK_LBUTTON) Then
Mausklick vbLeftButton, 10
Call GetAsyncKeyState(VK_LBUTTON)
ElseIf GetAsyncKeyState(VK_RBUTTON) Then
Mausklick vbRightButton, 10
Call GetAsyncKeyState(VK_RBUTTON)
ElseIf GetAsyncKeyState(VK_MBUTTON) Then
Mausklick vbMiddleButton, 10
Call GetAsyncKeyState(VK_MBUTTON)
End If
End Sub