some code to FYI模块:
Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredaccess&, ByVal bInherithandle&, ByVal dwProcessid&) As LongDeclare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpexitcode As Long) As LongConst STILL_ACTIVE = &H103
Const PROCESS_QUERY_INFORMATION = &H400
程序:
hShell = Shell("调用的程序.exe", vbNormalFocus) hProc = OpenProcess(PROCESS_QUERY_INFORMATION, False, hShell)
Do
GetExitCodeProcess hProc, lExit
DoEvents
Loop While lExit <> STILL_ACTIVE
msgbox"程序结束"
Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredaccess&, ByVal bInherithandle&, ByVal dwProcessid&) As LongDeclare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpexitcode As Long) As LongConst STILL_ACTIVE = &H103
Const PROCESS_QUERY_INFORMATION = &H400
程序:
hShell = Shell("调用的程序.exe", vbNormalFocus) hProc = OpenProcess(PROCESS_QUERY_INFORMATION, False, hShell)
Do
GetExitCodeProcess hProc, lExit
DoEvents
Loop While lExit <> STILL_ACTIVE
msgbox"程序结束"
以上是我的个人观点.不知道是否正确.关注.. 希望高手解答......
aa = Shell("cmd /c ping ComputerName>C:\aa.txt")9x:
aa = Shell("c:\command.com /c ping ComputerName>C:\aa.txt")cmd.exe和command.com的具体路径自己指定.
通过/c参数就可以进行重定位到文件.多谢qsqwmy(禽兽)提醒,真是一语惊醒梦中人啊....斑竹看看是否可以加到FAQ中啊,这个问题也困扰我很久了.呵呵,这样就可以不用api就可以知道当前w2k server启动了那些服务了. 爽~~~~~~~~~~~~~~
如果使用Shell "ping ComputerName -t" 如何才能中断这个操作?欢迎一起来讨论.
结帖喽…………………………………………