2016-08-12 96 views

回答

0

您需要調用Windows的API。這是如何製作標題欄更改程序。

使用記事本創建一個文件,並將其命名爲SetText.bas。將其存儲在桌面上。

將其粘貼到其中。

Imports System 
Imports System.Runtime.InteropServices 
Imports Microsoft.Win32 

Public Module MyApplication 

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long 
Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long 

Sub Main() 
    On Error Resume Next 
    Dim CmdLine As String 
    Dim Ret as Long 
    Dim A() as String 
    Dim hwindows as long 

    CmdLine = Command() 
    If Left(CmdLine, 2) = "/?" Then 
     MsgBox("Usage:" & vbCrLf & vbCrLf & "ChangeTitleBar Oldname NewName") 
    Else 
     A = Split(CmdLine, Chr(34), -1, vbBinaryCompare) 
     hwindows = FindWindow(vbNullString, A(1)) 
     Ret = SetWindowText(hwindows, A(3)) 

    End If 
End Sub 
End Module 

然後鍵入命令提示符窗口。

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc.exe" /target:winexe /out:"%userprofile%\desktop\SetText.exe" "%userprofile%\desktop\settext.bas" /verbose 

在您的桌面上創建了一個名爲settext.exe的程序。使用

"%userprofile%\desktop\settext" "Untitled - Notepad" "A Renamed Notepad" 
+0

不是每個人都會在他們的路徑中有'v4.0.30319 \ vbc.exe' –

相關問題