Hi Leute,
ich habe 2 Probleme mit einem kleinen Makro Programm das ich gerade schreibe.
1. Die Tasten w und danach s sollen gedrückt gehalten werden, was dann in wwwwwwwwwwwwwwssssssssssssssss resultieren soll, allerdings wird nur ws augegeben.
2. Die Befehle werden nicht an das Spiel Warframe weitergegeben (Makros sind in bestimmten Rahmen im Spiel erlaubt).
Hier nun das Programm:
ich habe 2 Probleme mit einem kleinen Makro Programm das ich gerade schreibe.
1. Die Tasten w und danach s sollen gedrückt gehalten werden, was dann in wwwwwwwwwwwwwwssssssssssssssss resultieren soll, allerdings wird nur ws augegeben.
2. Die Befehle werden nicht an das Spiel Warframe weitergegeben (Makros sind in bestimmten Rahmen im Spiel erlaubt).
Hier nun das Programm:
VB.NET-Quellcode
- Imports System.Runtime.InteropServices
- Public Class Form1
- Public Counter As Integer
- Public Const KEYEVENTF_KEYUP As Byte = &H2
- Public Const KEYEVENTF_EXTENDEDKEY As Byte = &H1
- Dim WithEvents startstoptmr As New Timer
- Dim autostopcounter As Integer
- <DllImport("user32.dll", CallingConvention:=CallingConvention.StdCall, _
- CharSet:=CharSet.Unicode, EntryPoint:="keybd_event", _
- ExactSpelling:=True, SetLastError:=True)> _
- Public Shared Function keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, _
- ByVal dwFlags As Int32, ByVal dwExtraInfo As Int32) As Boolean
- End Function
- Private Sub Start_Click(ByVal sEndr As System.Object, ByVal e As System.EventArgs) Handles Start.Click
- ForwardBack()
- Counter = 0
- Autostop()
- End Sub
- Private Sub Stopit_Click(ByVal sEndr As System.Object, ByVal e As System.EventArgs) Handles Stopit.Click
- Counter = 1
- startstoptmr.stop()
- End Sub
- Public Sub ForwardBack()
- Do While Counter <= 0
- If Counter <= 0 Then
- keybd_event(Keys.W, 0, 0, 0)
- Sleep(1000)
- keybd_event(Keys.W, 0, KEYEVENTF_KEYUP, 0)
- Sleep(200)
- If Counter <= 0 Then
- keybd_event(Keys.S, 0, 0, 0)
- Sleep(1000)
- keybd_event(Keys.S, 0, KEYEVENTF_KEYUP, 0)
- Sleep(200)
- End If
- End If
- Loop
- End Sub
- Sub Sleep(ByVal sleeptime As Integer)
- Dim Stopw As New Stopwatch
- Stopw.Start()
- Do Until Stopw.ElapsedMilliseconds >= sleeptime
- Application.DoEvents()
- Loop
- Stopw.Stop()
- Stopw.Reset()
- End Sub
- Public Sub Autostop()
- autostopcounter = 0
- startstoptmr.Interval = 10000
- startstoptmr.Start()
- End Sub
- Private Sub startstoptmr_Tick(ByVal sEndr As System.Object, ByVal e As System.EventArgs) Handles startstoptmr.Tick
- autostopcounter += 1
- If autostopcounter = 6 Then
- Counter = 1
- startstoptmr.stop()
- End If
- End Sub
- End Class