Source Code Ghetto GUI method for external cheats

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat


Full Member
Dec 26, 2012
If you want to make some ghetto ass GUI for your cheat with winforms, here's how:

Imports System.Runtime.InteropServices
Imports System.Windows.Forms ' Not required in most scenarios

Module GH_Framework

    Const TargetWindow As String = "Counter-Strike:Global Offensive" 'Your target window/game

    Sub Main()
    'Launched at start
    SetHook() 'This is where I "start"/place my hook, where you do it is entirely up to you
    End Sub
	#Region "KB-Hook"
	<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)>
    Private Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
    End Function

    Private Function SetForegroundWindow(ByVal hWnd As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean
    End Function

    Private Function GetWindowText(ByVal hWnd As IntPtr, ByVal txt As System.Text.StringBuilder, ByVal cnt As Integer) As Integer
    End Function

    Private Function GetForegroundWindow() As IntPtr
    End Function

    Private Function SetWindowsHookEx(idHook As Integer, callback As LowLevelKeyboardProc, hInstance As IntPtr, threadId As UInteger) As IntPtr
    End Function

    Private Function UnhookWindowsHookEx(hInstance As IntPtr) As Boolean
    End Function

    Private Function CallNextHookEx(idHook As IntPtr, nCode As Integer, wParam As Integer, lParam As IntPtr) As IntPtr
    End Function

    Private Function LoadLibrary(lpFileName As String) As IntPtr
    End Function

    Private Delegate Function LowLevelKeyboardProc(nCode As Integer, wParam As IntPtr, lParam As IntPtr) As IntPtr

    Const WH_KEYBOARD_LL As Integer = 13
    Const WM_KEYDOWN As Integer = &H100

    Private _proc As LowLevelKeyboardProc = AddressOf hookProc

    Private hhook As IntPtr = IntPtr.Zero

    Public Sub SetHook()
        Dim hInstance As IntPtr = LoadLibrary("User32")
        hhook = SetWindowsHookEx(WH_KEYBOARD_LL, _proc, hInstance, 0)
    End Sub

    Public Sub UnHook()
    End Sub
	Private Function isActiveWin(ByVal Target As String) As Boolean
        Dim hwnd As IntPtr = GetForegroundWindow()
        Dim sbuild As New System.Text.StringBuilder(255)
        GetWindowText(hwnd, sbuild, 255)
        If Target = sbuild.ToString Then
        Return True
        Return False
        End If
    End Function 'Returns true if specified window is active

    Private Sub SelectWin(ByVal name As String)
        Dim ptr As IntPtr = FindWindow(Nothing, name)
    End Sub 'Sets specified window to active

    Dim exKilled As Boolean = False

    Public Function hookProc(code As Integer, wParam As IntPtr, lParam As IntPtr) As IntPtr
        Dim vkCode As Integer = Marshal.ReadInt32(lParam)
        Dim ValidKeyDown As Boolean = False
        If vkCode = Keys.Insert.GetHashCode() OrElse vkCode = Keys.Delete.GetHashCode() Then
            ValidKeyDown = True
        End If
        If code >= 0 AndAlso wParam = WM_KEYDOWN AndAlso ValidKeyDown Then
            If vkCode = Keys.Insert.GetHashCode() Then
                If isActiveWin(TargetWindow) Then 'Checks if target window is active
                    If Not exKilled Then 'If explorer.exe is running, kill it (windows bar etc.) *
                        Shell("taskkill /f /im explorer.exe") 'Force kill explorer
                        exKilled = True
                    End If
                    externForm.Show() 'This is the GUI form that you've made
                    SelectWin("This is a GUI") 'Select that window^                    
                Else If isActiveWin("This is a GUI")                    
                    externForm.Hide() 'Hide our GUI
                    SelectWin(TargetWindow) 'And re-select our target
                End If            
            End If
            If vkCode = Keys.Delete.GetHashCode() Then
                Process.Start("c:\windows\explorer.exe") 'Manually restarting explorer.exe
            End If
            Return 1

            Return CallNextHookEx(hhook, code, CInt(wParam), lParam)
        End If
    End Function

#End Region

End Module
If you don't feel safe force-killing explorer you can change the registry to prevent it from automatically restarting with something like this.

    Dim key As Microsoft.Win32.Registry
    Dim ourkey As Microsoft.Win32.RegistryKey
    ourkey = key.LocalMachine
    ourkey = ourkey.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", True)
    ourkey.SetValue("AutoRestartShell", 0)
    'do your thang and fix it with
    ourkey.SetValue("AutoRestartShell", 1)
Killing explorer also seems to affect things like ClassicShell so you would have to find solutions for this as well.


Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods