11211.html

来自「VB技巧问答10000例 VB技巧问答10000例」· HTML 代码 · 共 23 行

HTML
23
字号
<html>
  <head>
    <title>Re: 以Shell呼叫其他程式??</title>
  </head>
  <body bgcolor="#FFFFFF" vlink="#808080">
    <center>
      <h1>Re: 以Shell呼叫其他程式??</h1>
    </center>
<hr size=7 width=75%>

<hr size=7 width=75%><p>
Posted by lee on March 20, 1999 at 17:16:44:<p>
In Reply to: <a href="11144.html">以Shell呼叫其他程式??</a> posted by Lai on March 19, 1999 at 13:25:12:<p>
: 我以Shell函数呼叫其他程式(.exe)执行时<br>: 为何被呼叫的程式尚未执行完成就结束<br>: 回到原来呼叫的下一行句子,何故?可有解决之道?<br>: 请协助.thanks..<p>API 的宣告:<p>Const SYNCHRONIZE = &H100000<br>Const INFINITE = &HFFFFFFFF <br>Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long <br>Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long <br>Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long<p>程式范例:(以执行 Notepad 程式为例)<p>Dim pId As Long, pHnd As Long <br>pId = Shell("Notepad", vbNormalFocus) <p>pHnd = OpenProcess(SYNCHRONIZE, 0, pId) <br>If pHnd <> 0 Then <br>    Call WaitForSingleObject(pHnd, INFINITE) <br>    Call CloseHandle(pHnd) <br>End If <p>
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 11211-->
</ul><!--end: 11211-->
<br><hr size=7 width=75%><p>

</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?