我可以使用 VB.net 检索 MS-DOS 窗口的标题吗?
使用下面的代码,我可以检索远程计算机上DOS命令窗口的图像名称和进程ID,但我也可以检索DOS窗口标题吗?
Dim current As Process = Process.GetCurrentProcess()
Dim processes As Process() = Process.GetProcesses("REMOTE_COMPUTER")
Dim ThisProcess As Process
For Each ThisProcess In processes
If ThisProcess.ProcessName.ToUpper.Contains("CMD") Then
ListBox1.Items.Add("Process Name: " & ThisProcess.ProcessName & vbTab & "Process ID: " & ThisProcess.Id)
End If
Next
Using the below code, I can retrieve the image name and process ID of the DOS command window on a remote machine, but can I also retrieve the DOS window title?
Dim current As Process = Process.GetCurrentProcess()
Dim processes As Process() = Process.GetProcesses("REMOTE_COMPUTER")
Dim ThisProcess As Process
For Each ThisProcess In processes
If ThisProcess.ProcessName.ToUpper.Contains("CMD") Then
ListBox1.Items.Add("Process Name: " & ThisProcess.ProcessName & vbTab & "Process ID: " & ThisProcess.Id)
End If
Next
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
我正在使用
user32.dll
中的GetWindowText
并正在寻找Process
属性来获取主窗口处理程序,所以我偶然发现了MainWindowTitle
属性有时并不需要太难。
Try this:
I was playing with
GetWindowText
fromuser32.dll
and was looking for aProcess
property to get main window handler, so i stumbled with thatMainWindowTitle
propertySometimes, it doesn't need to be hard.