VB高手帮帮忙吧,把VBS代码转化成VB代码
vb吧
全部回复
仅看楼主
level 3
wwwylg 楼主
set shell = createobject("WScript.Shell")
Shell.Run "cmd.exe"
Set Processes = GetObject("winmgmts:").InstancesOf("Win32_Process")
For Each Process In Processes
If StrComp(Process.Name, "cmd.exe", vbTextCompare) = 0 Then
'用进程ID激活窗口
With CreateObject("WScript.Shell")
.AppActivate Process.ProcessId
.SendKeys "4"
End With
'找到了进程ID,退出FOR
Exit For
End If
Next
2022年08月01日 11点08分 1
level 12
这个不是可以直接在VB6里运行嘛。
2022年08月01日 18点08分 2
确实可以,测试OK,谢谢。[呵呵]
2022年08月02日 09点08分
1