VB 版 (精华区)
发信人: zxfsnow (最近睡眠太少), 信区: VB
标 题: 等待shell结束
发信站: 哈工大紫丁香 (2000年06月08日11:51:28 星期四), 转信
发信人: zhchzhchzhch (zhchzhchzhch), 信区: VB
标 题: [转载]等待shell结束
发信站: NJU Lily BBS (Thu Mar 18 21:04:37 1999), 站内信件
' ShellWat sample by Matt Hart - mhart@taascforce.com
' http://www.webczar.com/defcon/mh/vbhelp.html
' http://www.webczar.com/defcon/mh
'
' Shows how to shell to another program, and wait until it finishes
' before continuing.
Private Declare Function WaitForSingleObject Lib "kernel32" _
(ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Private Const INFINITE = -1&
Private Const SYNCHRONIZE = &H100000
Private Sub Command1_Click()
Dim iTask As Long, ret As Long, pHandle As Long
iTask = Shell("notepad.exe", vbNormalFocus)
pHandle = OpenProcess(SYNCHRONIZE, False, iTask)
ret = WaitForSingleObject(pHandle, INFINITE)
ret = CloseHandle(pHandle)
MsgBox "Process Finished!"
End Sub
--
※ 修改:.zhchzhchzhch 于 Mar 18 21:14:21 修改本文.[FROM: dsl.nju.edu.cn]
--
以科计为本,以产业报国!
超越自我,飞跃无限!
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.235.249]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:1.278毫秒