Macro & QuickSwitch Sourcecodes (VB.NET) by R3DDOT
So, I'm releasing the codes for my macro & quickswitch.
I'm not that interested in making them anymore, therefore I thought to my self "Why not share them with everyone?"
Use them as you wish.
Module:
On Form(QuickSwitch):
On Form(Macro):
I placed here nearly everything you'll need to make your own macros & quickswitches. The rest is totally up to you, to edit and adapt to your needs.
If you use this code, all I'm gonna ask is for you to give me credits, even though it's totally up to you.
Any questions, comment below and someone will help you out, being that me or anyone from MPGH, really.
PS: I'll put a project in the attachments later on, if you wish to use it ofc.
FYI, I've been getting a lot of buddy request asking me to helping you out making hacks or macros or whatever. I don't mind helping out, as long as you know what you are doing. If you come here, without any knowledge of the language whatsoever trying to code a macro or a hack or whatever, you'll face some really big challenges and you'll most likely giveup, or worse, not knowing what you're doing, and just copy&paste code from other people. If you wish to learn the language, take a look at some tutorials, learn step-by-step, and if you have any doubts, a lot of members will willingly provide some help.
I'm not that interested in making them anymore, therefore I thought to my self "Why not share them with everyone?"
Use them as you wish.
Module:
Code:
Imports System.Runtime.InteropServices
Module MacroModulebyR3DDOT
<System.Runtime.InteropServices.DllImport("user32.dll")> Public Function GetAsyncKeyState(ByVal e As System.Windows.Forms.Keys) As Short
End Function
Public Function GetKeyState(ByVal e As System.Windows.Forms.Keys) As Boolean
Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
#Region "Window Stuff"
<DllImport("user32.dll", CharSet:=CharSet.Auto, ExactSpelling:=True)> _
Public Function GetForegroundWindow() As IntPtr
End Function
Public Declare Auto Function FindWindow Lib "user32.dll" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
#End Region
Public Sub LeftClick() 'Left Mouse Button Click.
mouse_event(&H2, 0, 0, 0, 0)
mouse_event(&H4, 0, 0, 0, 0)
End Sub
Public Sub RightClick() 'Right Mouse Button Click.
mouse_event(&H8, 0, 0, 0, 0)
mouse_event(&H10, 0, 0, 0, 0)
End Sub
Public Sub MiddleClick() 'Middle Mouse Button Click.
mouse_event(&H20, 0, 0, 0, 0)
mouse_event(&H40, 0, 0, 0, 0)
End Sub
On Form(QuickSwitch):
Code:
Dim AllowedToShoot as Boolean
Dim QSTicks as Integer
[...]
'Find your own interval for your timer. Do it through trial and error, and you'll get there.
'Alternative: Add textbox so user can customize the interval between ticks.
Private Sub QuickSwitchTMR_Tick(sender As Object, e As EventArgs) Handles QuickSwitchTMR.Tick
Dim QSHotkey As Boolean = GetKeyState(Keys.LButton)
If AllowedToShoot = False Then 'Anti-bug function. Skips 1 tick, regardless if LButton is in usage or not. While QSTicks < 2 Then
QSTicks += 1
Exit Sub
End While
QSTicks = 0
AllowedToShoot = True
End If
Dim hWnd As IntPtr = FindWindow(AVAWindowClass, Nothing) 'Gets handle of AVA Window.
Dim ForeGroundWindow As IntPtr = GetForegroundWindow() 'Gets handle of currently Active Window.
If hWnd = ForeGroundWindow Then ' If AVA Window is in usage, it will do the QS, otherwise, it will skip the function.
If AllowedToShoot = True Then
If QSHotkey = True Then
If QSHotkey = True Then
If QSS12.Checked = True Then 'These are radio buttons from the form. Adapt the code to fit your own assembly.
SendKeys.Send("2") 'Here I'm using the SendKeys.Send() method.
SendKeys.Send("1") 'Alternative: Reference InputSimulator.dll and Import WindowInput.
ElseIf QSS13.Checked = True Then
SendKeys.Send("3")
SendKeys.Send("1")
ElseIf QSS14.Checked = True Then
SendKeys.Send("4")
SendKeys.Send("1")
ElseIf QSSQQ.Checked = True Then
SendKeys.Send("q")
SendKeys.Send("q")
ElseIf QSSQ2.Checked = True Then
SendKeys.Send("2")
SendKeys.Send("q")
ElseIf QSS3Q.Checked = True Then
SendKeys.Send("3")
SendKeys.Send("q")
ElseIf QSS4Q.Checked = True Then
SendKeys.Send("4")
SendKeys.Send("q")
End If
AllowedToShoot = False 'Turns it false to trigger the anti-bug function above.
End If
End If
End If
End Sub
Code:
[...]
'If you want add a textbox so the user can customize the interval between ticks.
Private Sub MacroTMR_Tick(sender As Object, e As EventArgs) Handles MacroTMR.Tick
Dim hotkey As Boolean = GetKeyState(Keys.LButton)
Dim hWnd As IntPtr = FindWindow(AVAWindowClass, Nothing) 'Gets handle of AVA Window.
Dim ForeGroundWindow As IntPtr = GetForegroundWindow() 'Gets handle of the current Active Window.
If hWnd = ForeGroundWindow Then 'Checks if AVA Window is the active window. If true, then checks if LButton is currently in usage, if it is, then the macro function is called(Macros usually use the MiddleClick Function)
If hotkey = True Then
Try
Call MiddleClick()
Catch ex As Exception
Messagebox.show(ex.message)
End Try
End If
End If
End Sub
If you use this code, all I'm gonna ask is for you to give me credits, even though it's totally up to you.
Any questions, comment below and someone will help you out, being that me or anyone from MPGH, really.
PS: I'll put a project in the attachments later on, if you wish to use it ofc.
FYI, I've been getting a lot of buddy request asking me to helping you out making hacks or macros or whatever. I don't mind helping out, as long as you know what you are doing. If you come here, without any knowledge of the language whatsoever trying to code a macro or a hack or whatever, you'll face some really big challenges and you'll most likely giveup, or worse, not knowing what you're doing, and just copy&paste code from other people. If you wish to learn the language, take a look at some tutorials, learn step-by-step, and if you have any doubts, a lot of members will willingly provide some help.

