因此,我喜欢时不时地制作一些batch-file小游戏,而这一次,我希望标题是动画的。我想不出从另一个batch文件(CMD)中更改标题的方法。如果你们中的一个能帮助我就太好了,因为这将是这个游戏的最后一笔。
发布于 2016-08-12 12:29:55
您需要调用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"https://stackoverflow.com/questions/38909477
复制相似问题