onlinegamehacking@forumn.com


    VB.NET d3d menu

    Share
    avatar
    OGHgamer
    PROGRAMMER
    PROGRAMMER

    Posts : 64
    Join date : 2012-11-02

    VB.NET d3d menu

    Post by OGHgamer on Fri Jul 12, 2013 4:59 pm

    [b class="bbc" style="color: rgb(128, 128, 128); font-family: arial, verdana, sans-serif; font-size: 12px; line-height: 19px; background-color: rgb(18, 18, 18);"]# Basic D3D Menu for DirectX 8|9[/b]
    [b class="bbc"]
    Needed:[/b]




    [b class="bbc"]OK, let's begin![/b]

    At first we need to make a simple WindowsForm project.


    Then compile it and click on [ [b class="bbc"]Save all...[/b] ].

    [b class="bbc"]Notice:[/b] The renametoanything.dll (btw you should do what the file name tells you) MUST be in your program folder! (For testing in VB put it into Debug/Release of your project folder)

    [b class="bbc"]Functions and Variables[/b]
    yourdll.dll" (ByVal wTextPosX As Short, ByVal wTextPosY As Short, _
    ByVal LPCTSTR As String, ByVal dwTextColor As Integer, ByVal bBlackBackground As Boolean, ByVal cSize As Byte, ByVal bTextBold As Boolean, ByVal cFontFamily As Byte) As Boolean
    Private Declare Function GPSL_ShowText Lib "[b class="bbc"]yourdll.dll[/b]" (ByVal bShowIt As Boolean) As Boolean
    Dim func1 As String = "Function 1"
    Dim func2 As String = "Function 2"
    Dim func3 As String = "Function 3"
    Dim func1_bh As String = Nothing
    Dim func2_bh As String = Nothing
    Dim func3_bh As String = Nothing
    Dim func1_bf As String = Nothing
    Dim func2_bf As String = Nothing
    Dim func3_bf As String = Nothing
    Dim AllText As String
    Public v_menuvisible As Boolean = False
    Public v_isrshown As Boolean = False
    Public v_islshown As Boolean = False
    Public v_waitvar As Integer = Nothing _linenums:0'>Private Declare Function GetAsyncKeyState Lib "User32" (ByVal vKey As Long) As Integer Private Declare Function GPSL_SetTextLineData Lib "<strong class='bbc'>yourdll.dll</strong>" (ByVal wTextPosX As Short, ByVal wTextPosY As Short, _ ByVal LPCTSTR As String, ByVal dwTextColor As Integer, ByVal bBlackBackground As Boolean, ByVal cSize As Byte, ByVal bTextBold As Boolean, ByVal cFontFamily As Byte) As Boolean Private Declare Function GPSL_ShowText Lib "yourdll.dllstrong>" (ByVal bShowIt As Boolean) As Boolean Dim func1 As String = "Function 1" Dim func2 As String = "Function 2" Dim func3 As String = "Function 3" Dim func1_bh As String = Nothing Dim func2_bh As String = Nothing Dim func3_bh As String = Nothing Dim func1_bf As String = Nothing Dim func2_bf As String = Nothing Dim func3_bf As String = Nothing Dim AllText As String Public v_menuvisible As Boolean = False Public v_isrshown As Boolean = False Public v_islshown As Boolean = False Public v_waitvar As Integer = Nothing

    [b class="bbc"]Notice:[/b] You have to change the "yourdll.dll" with the name of your Library.

    Now the Explanations to those things:


    • [b class="bbc"]GetAsyncKeyState[/b] == Simple Hotkey Function
    • [b class="bbc"]GPSL_SetTextLineData[/b] == Configures the Shown text
    • [b class="bbc"]GPSL_ShowText[/b] == Shows your configured text (True = shown | False = hidden)
    • [b class="bbc"]func*[/b] == The shown Menu Point from one item
    • [b class="bbc"]func*_bh[/b] == Shown text behind your menu point ( [ON] | [OFF] )
    • [b class="bbc"]func*_bf[/b] == Shown text before your menu point ( If selected, Chars like "+" | "~" )
    • [b class="bbc"]AllText[/b] == Complete Menu text
    • [b class="bbc"]v_menuvisible[/b] == Boolean if menu is visible or not
    • [b class="bbc"]v_isrshown[/b] == If a function is [ON]
    • [b class="bbc"]v_islshown[/b] == If a function is [OFF]
    • [b class="bbc"]v_waitvar[/b] == Variable for changing the menupoints (Needed, because otherwise you would ho straight to the last/first menu item)


    [b class="bbc"]What to create[/b]

    This is a list of items, that you'll need:


    • [b class="bbc"]1 Timer[/b] r=#00ff00]True] [Interval: 1-100] || This sets your text anytime if it's changed! || call it like "txt"
    • [b class="bbc"]At least 2 Timers[/b] r=#ff0000]False] [Interval: 1] || One is for your basic position (If nothing is selected) and ONE for EACH function
    • --> F.E. If you want to have 5 Items in your menu, create six timers! || Call them like "pos0" / "pos1" ...
    • [b class="bbc"]Your own timers / modules etc.[/b] for your hack functions or else


    [b class="bbc"]Notice:[/b] In this example source I used [b class="bbc" style="color: rgb(128, 128, 128); font-family: arial, verdana, sans-serif; font-size: 12px; line-height: 19px; background-color: rgb(18, 18, 18);"]3[/b] Menu items. You have to create more/less timers and change the txtTimer, if you have more/less functions!

    [b class="bbc"]Setting the Basic text[/b]

    Dim insert As Boolean = GetAsyncKeyState(Keys.Insert)Dim delete As Boolean = GetAsyncKeyState(Keys.Delete)Dim down As Boolean = GetAsyncKeyState(Keys.Down)If insert = True Then GPSL_ShowText(True) v_menuvisible = TrueElseIf delete = True Then v_menuvisible = False GPSL_ShowText(False)End IfIf v_menuvisible = True Then If down = True Then func1_bf = " + " pos1.Start() pos0.Stop() End IfEnd If
    It might be hard to understand so I explain some things here: First we declare insert, delete and down (the arrow key) as hotkeys. If insert is pressed our menu will pop up and the variable v_menuvisible is true, if delete is pressed it'll hide and v_menuvisible will be false.
    Then, if you press down, the first function will be selected (you see it at the " + " in front of it), we leave this position (pos0.stop()) and go to the first menu position (pos1.start())

    Now we go to the source of position 1. (You do not need to enable this timer, because pos0 will do it for you)
    Dim insert As Boolean = GetAsyncKeyState(Keys.Insert) Dim delete As Boolean = GetAsyncKeyState(Keys.Delete) Dim down As Boolean = GetAsyncKeyState(Keys.Down) Dim up As Boolean = GetAsyncKeyState(Keys.Up) Dim right As Boolean = GetAsyncKeyState(Keys.Right) Dim left As Boolean = GetAsyncKeyState(Keys.Left) v_waitvar += 1 If v_waitvar > 10 Then If insert = True Then v_menuvisible = True GPSL_ShowText(True) ElseIf delete = True Then GPSL_ShowText(False) v_menuvisible = False End If If v_menuvisible = True Then If right = True Then If v_isrshown = False Then func1_bh = " [ON]" v_isrshown = True v_islshown = False 'PLACE FOR YOUR FUNCTION HERE! 'superjump.start() ... End If End If If left = True Then If v_islshown = False Then func1_bh = " [OFF]" v_islshown = True v_isrshown = False 'PLACE FOR YOUR FUNCTION HERE! 'superjump.stop() ... End If End If End If If down = True Then func1_bf = Nothing func2_bf = " + " pos2.Start() pos1.Stop() v_waitvar = Nothing v_islshown = False v_isrshown = False End If If up = True Then func1_bf = Nothing pos0.Start() pos1.Stop() v_waitvar = Nothing v_islshown = False v_isrshown = False End If End If

    This is a bit more complicated, but not as difficult as it seems to be.
    At first we increase v_waitvar and wait until it's 10 or more, because otherwise we'd go straight to the last menu point.
    Then, insert for show, delete for hide, nothing new.
    OK, now: If the menu is visible (v_menuvisible = True) and you press the right arrow key, func1_bh will be [ON]. Here you have to put your function/hack for that menupoint ON.
    If you press the left arrow key, func1_bh will be [OFF]. Here you have to put your hack/function for that menupoint OFF.
    If you press the up key, you will go to position 0, if you press down, you will go to position 2!
    [b class="bbc" style="color: rgb(128, 128, 128); font-family: arial, verdana, sans-serif; font-size: 12px; line-height: 19px; background-color: rgb(18, 18, 18);"]
    Important notice:
    [/b] Anytime you add a menupoint that is not the first or last postion, you have to add this for up is pressed:
    *_bf = Nothing
    pos*.Start()
    pos*.Stop()
    v_waitvar = Nothing
    v_islshown = False
    v_isrshown = False _linenums:0'>func*_bf = Nothingpos*.Start()pos*.Stop()v_waitvar = Nothingv_islshown = Falsev_isrshown = False

    And this for down is pressed:
    *_bf = Nothing
    func*_bf = " + "
    pos*.Start()
    pos*.Stop()
    v_waitvar = Nothing
    v_islshown = False
    v_isrshown = False _linenums:0'>func*_bf = Nothingfunc*_bf = " + "pos*.Start()pos*.Stop()v_waitvar = Nothingv_islshown = Falsev_isrshown = False


    OK, you can take the source for pos1 for ANY menupoint, that is NOT the first/last.
    For the first one, take pos0 and here the code for the last one:
    Dim insert As Boolean = GetAsyncKeyState(Keys.Insert) Dim delete As Boolean = GetAsyncKeyState(Keys.Delete) Dim up As Boolean = GetAsyncKeyState(Keys.Up) Dim right As Boolean = GetAsyncKeyState(Keys.Right) Dim left As Boolean = GetAsyncKeyState(Keys.Left) v_waitvar += 1 If v_waitvar > 10 Then If insert = True Then v_menuvisible = True GPSL_ShowText(True) ElseIf delete = True Then GPSL_ShowText(False) v_menuvisible = False End If If v_menuvisible = True Then If right = True Then If v_isrshown = False Then func3_bh = " [ON]" v_isrshown = True v_islshown = False End If End If If left = True Then If v_islshown = False Then func3_bh = " [OFF]" v_islshown = True v_isrshown = False End If End If End If If up = True Then func2_bf = " + " func3_bf = Nothing pos2.Start() pos3.Stop() v_waitvar = Nothing v_islshown = False v_isrshown = False End If End If

    You will see, only down is removed, because there is now menupoint below that 

    [b class="bbc"]The d3d8/9.dll[/b]

    If you compiled this project, before we came to this point, you noticed, that nothing pops up! That's because one file is missing! [b class="bbc" style="color: rgb(128, 128, 128); font-family: arial, verdana, sans-serif; font-size: 12px; line-height: 19px; background-color: rgb(18, 18, 18);"]d3d8.dll[/b] for DirectX8 Programs. [b class="bbc" style="color: rgb(128, 128, 128); font-family: arial, verdana, sans-serif; font-size: 12px; line-height: 19px; background-color: rgb(18, 18, 18);"]d3d9.dll[/b] for DirectX9 Programs.
    It has to be in the same folder of the program.

    Now, I'm sure you don't want any of your program user to copy this into their program folder, so you can do this:
    ProcessLAUNCHER").Length <> Nothing Then
    processdir = Process.GetProcessesByName("ProcessLAUNCHER")(0).StartInfo.WorkingDirectory.ToString()
    My.Computer.FileSystem.CopyFile("Files\d3d8.dll", processdir & "\Data\d3d8.dll", True)
    My.Computer.Network.DownloadFile("http _linenums:0'>Public processdir As StringPrivate Sub processruncheck_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles processruncheck.Tick If Process.GetProcessesByName("ProcessLAUNCHER").Length <> Nothing Then processdir = Process.GetProcessesByName("ProcessLAUNCHER")(0).StartInfo.WorkingDirectory.ToString() My.Computer.FileSystem.CopyFile("Files\d3d8.dll", processdir & "\Data\d3d8.dll", True) My.Computer.Network.DownloadFile("http://myserver.mydomain.net/files/d3d8.dll", processdir & "\Data\d3d8.dll", "", "", False, 5000, True) processruncheck.Stop() pos0.Start() End IfEnd Sub

    This works better, if you do this with the LAUNCHER of your program, so the library is copied already when the process starts. There are 2 possibilitys. CopyFiles and DownloadFile (I think the name is enough), of course change the paths in the source 

    And for closing OUR program
    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    My.Computer.FileSystem.DeleteFile(processdir & "\d3d8.dll", FileIO.UIOption.OnlyErrorDialogs)
    End Sub


    [b class="bbc"]OK, we're done now![/b]

    Your sexy new D3D Menu will look like this:


    [b class="bbc"]Information[/b]

    I will translate that into German if anyone got problems with it! 

    Now, at least at this point many pros in C++ will say: "Bah! Far too complicated!" 
    This might be more complicated than a "normal" D3D Menu in C++ but this is easier especially for newbies. And you can easily switch between DirectX8/9 and you don't need the DirectX SDK.

    Credits:

    • Me (Maxn™)
    • Mikoweb


    Have Fun! If there are any questions, don't shy to place them 
    Attached Files
    credits @http://forum.ghbsys.net/index.php?/topic/10440-vbnetd3d-menu/


      Current date/time is Mon Nov 20, 2017 9:19 am