Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- REM Two files follow
- REM SetWindowText.bat
- REM This file compiles SetWindowText.vb to SetWindowText.exe using the system VB.NET compiler.
- REM SetWindowText.exe sets the titlebar text for a window
- REM SetWindowText.exe "OldWindowTitle" "NewWindowTitle"
- REM EG Open notepad and type in a command prompt
- REM SetWindowText.exe "Untitled - Notepad" "My Window Title"
- "C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc.exe" /target:winexe /out:"%~dp0\SetWindowText.exe" "%~dp0\SetWindowText.vb" /verbose
- pause
- ------------------------------------------------------
- 'SetWindowText.vb
- Imports System
- Imports System.Runtime.InteropServices
- Imports Microsoft.Win32
- Public Module MyApplication
- Public Declare UNICODE Function FindWindowW Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
- Public Declare UNICODE Function SetWindowTextW Lib "user32" (ByVal hwnd As IntPtr, ByVal lpString As String) As Integer
- Sub Main()
- On Error Resume Next
- Dim CmdLine As String
- Dim Ret as Integer
- Dim A() as String
- Dim hwindows as IntPtr
- CmdLine = Command()
- If Left(CmdLine, 2) = "/?" Then
- MsgBox("Usage:" & vbCrLf & vbCrLf & "SetText ""OldWindowTitle"" ""NewWindowTitle""")
- Else
- A = Split(CmdLine, Chr(34), -1, vbBinaryCompare)
- hwindows = FindWindowW(vbNullString, A(1))
- Ret = SetWindowTextW(hwindows, A(3))
- End If
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment