Gruppe
API
Problem
Wie kann ich die Mausposition nach Points auslesen?
StandardModule: basMain
Declare Function GetCursorPos& Lib "user32" (lpPoint As POINTAPI)
Type POINTAPI
x As Long
y As Long
End Type
Sub Orientieren()
Dim lPos As Long
Dim PT As POINTAPI
If Application.DisplayFullScreen = False Then
Beep
MsgBox "Zuerst Schaltfläche 'Start' drücken!"
Exit Sub
End If
lPos = GetCursorPos(PT)
If PT.x >= 3 And PT.x <= 30 And PT.y >= 198 And PT.y <= 240 Then
MsgBox "Bad Honnef"
ElseIf PT.x >= 68 And PT.x <= 116 And PT.y >= 328 And PT.y <= 337 Then
MsgBox "Linz am Rhein"
ElseIf PT.x >= 214 And PT.x <= 239 And PT.y >= 238 And PT.y <= 264 Then
MsgBox "Neustadt/Wied"
ElseIf PT.x >= 207 And PT.x <= 240 And PT.y >= 145 And PT.y <= 182 Then
Beep
MsgBox "Asbach"
ElseIf PT.x >= 222 And PT.x <= 237 And PT.y >= 278 And PT.y <= 293 Then
MsgBox "Autobahnabfahrt Neustadt/Wied"
ElseIf PT.x >= 236 And PT.x <= 251 And PT.y >= 288 And PT.y <= 309 Then
MsgBox "Autobahntankstelle Fernthal"
ElseIf PT.x >= 112 And PT.x <= 127 And PT.y >= 194 And PT.y <= 209 Then
MsgBox "Autobahnabfahrt Bad Honnef/Linz"
ElseIf PT.x >= 52 And PT.x <= 67 And PT.y >= 131 And PT.y <= 146 Then
MsgBox "Autobahnabfahrt Siebengebirge"
ElseIf PT.x >= 182 And PT.x <= 201 And PT.y >= 126 And PT.y <= 144 Then
MsgBox "Buchholz"
ElseIf PT.x >= 141 And PT.x <= 159 And PT.y >= 201 And PT.y <= 217 Then
MsgBox "Windhagen"
ElseIf PT.x >= 42 And PT.x <= 70 And PT.y >= 90 And PT.y <= 111 Then
MsgBox "Oberpleis"
ElseIf PT.x >= 8 And PT.x <= 33 And PT.y >= 105 And PT.y <= 135 Then
MsgBox "Heisterbacherrott"
ElseIf PT.x >= 33 And PT.x <= 58 And PT.y >= 142 And PT.y <= 163 Then
MsgBox "Ittenbach"
ElseIf PT.x >= 121 And PT.x <= 143 And PT.y >= 250 And PT.y <= 274 Then
MsgBox "Vettelschoß"
ElseIf PT.x >= 130 And PT.x <= 149 And PT.y >= 294 And PT.y <= 310 Then
MsgBox "St. Katharinen"
Else
MsgBox "Bitte einen Ort oder eine Autobahnabfahrt anklicken!"
End If
End Sub
Sub Zurueck()
With Application
.DisplayFullScreen = Not .DisplayFullScreen
End With
If [Button].Caption = "Zurück" Then
[Button].Caption = "Start"
Else
[Button].Caption = "Zurück"
End If
End Sub