Jesus christ you're retarded as hell. Here, fully working code.
Code:
Imports System
Imports System.Diagnostics
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Namespace RetardationInProgramming
Public Partial Class Form1
Inherits Form
<DllImport("user32.dll")> _
<Return: MarshalAs(UnmanagedType.Bool)> _
Private Shared Function SetForegroundWindow(ByVal hWnd As IntPtr) As Boolean
End Function
<DllImport("user32.dll")> _
Private Shared Function GetForegroundWindow() As IntPtr
End Function
Public Sub New()
InitializeComponent()
End Sub
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
If button1.Text & "Start" Then
button1.Text = "Stop"
Else
button1.Text = "Start"
End If
End Sub
Private Sub timer1_Tick(ByVal sender As Object, ByVal e As EventArgs)
' We don't want this running when button1's text is Start
If button1.Text & "Start" Then
' Get the current foreground window handle.
Dim currForeground As IntPtr = GetForegroundWindow()
' Store the process here. (You can also use a different process too
Dim wowProc As Process = Process.GetProcessesByName("Wow")(0)
' Check if WoW is the current foreground window, if not,
' bring it to the front.
If currForeground <> wowProc.MainWindowHandle Then
SetForegroundWindow(wowProc.MainWindowHandle)
End If
' Send our keys.
SendKeys.SendWait("1")
' Go back to the original window.
SetForegroundWindow(currForeground)
' We're done here. :)
End If
End Sub
End Class
End Namespace