ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 3759

VB.NET Setting an External Program's Title window

by 1UP - 10-10-2016 - 11:34 PM
#1
I have been working on making some trainers for some games and I wanted a basic way of showing that a cheat was enabled. I couldn't figured out how to draw to the screen so I figured the title bar would be fine.

Code:
Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hWnd As IntPtr, ByVal lpString As String) As Boolean

    Public Sub SetTitleText(ByVal processName() As Process, ByVal textToSend As String)

        For Each proc In processName
            SetWindowText(proc.MainWindowHandle, textToSend)
        Next
    End Sub

The code above will allow you to set the title window to an external program.

An example on how to use it

Code:
Dim notepad() As Process = Process.GetProcessesByName("notepad")

    Private Sub btn_Notepad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Notepad.Click
       SetTitleText(notepad,"Insert some text here")

    End Sub
Reply

Users browsing: 2 Guest(s)