Macro & QuickSwitch Sourcecodes (VB.NET) by R3DDOT

Posts 1–11 of 11 · Page 1 of 1
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:
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
On Form(Macro):

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
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.
@R3DDOT Thanks a lot for this release bro !
thank you )
Thanks for the source. I understand what you mean by helping people out, as long as they know the language. If they no next to nothing about the language,and you help them, it's basically you coding the macro, not them.
Thanks R3DDOT. This is an excellent. One thing confuses me though is why do you have "[...]"?
Also is it possible for you upload the source code? If I do create anything using your work, I will include credits, since I hate leeching. Thanks.
how to make a source code to a hack ? Can anyone help me to start coding?Please
Hello

can you post the src of your macro VB.net project ?

I would try it to compile for win xp plateform with .net 3.5.

Thanks
how can i add the textbox to change the delay of the QuickSwitch??
can someone help me plz @R3DDOT
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
Posts 1–11 of 11 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?