精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● VB和Basic>>〓〓..API 函数使用..〓〓>>系统操作和其他>>判断我的shell命令已经执行完

主题:判断我的shell命令已经执行完
发信人: chui8()
整理人: winsy(2003-03-05 16:15:10), 站内信件
【 在 jiechang (云中羽) 的大作中提到: 】
: 我在VB中用shell函数运行COPY命令,请问我该如何知道COPY
: 已经完成?
 Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAc
cess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long)
 As Long
 Public Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hpro
cess As Long, lpExitCode As Long) As Long
 Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As 
Long) As Long
 Const fdwAccess = &H401

 ProcessID = Shell("copy a b", 0) '''''''0表示窗口不见
 hprocess = OpenProcess(fdwAccess, False, ProcessID)
 do 
   GetExitCodeProcess hprocess, nRet
 Loop While nRet = STILL_ACTIVE
 Call CloseHandle(hprocess)
''''''''''''''do your things

--
※ 修改:.chui8 于 Jan 11 14:26:41 修改本文.[FROM: 202.96.191.124]
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.96.191.124]

[关闭][返回]