ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[¤À¨É] Åýµ{¦¡µ¥«Ý¦Ü¤W¤@­Ó¶}±Òªº°õ¦æµ{¦¡µ²§ô

[¤À¨É] Åýµ{¦¡µ¥«Ý¦Ü¤W¤@­Ó¶}±Òªº°õ¦æµ{¦¡µ²§ô

¥»©«³Ì«á¥Ñ Min ©ó 2010-5-3 23:03 ½s¿è

Option Explicit

Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Public Const SYNCHRONIZE = &H100000
Public Const INFINITE = &HFFFFFFFF

Sub WaitProcess()
    Dim Pid As String
    Dim pHnd As String
   
    Pid = Shell("C:\Windows\system32\notepad.exe", vbNormalFocus)   ' Shell ¶Ç¦^ Process Id
    pHnd = OpenProcess(SYNCHRONIZE, 0, Pid) ' ¨ú±o Process Handle
    If pHnd <> 0 Then
        Call WaitForSingleObject(pHnd, INFINITE) ' µL­­µ¥«Ý¡Aª½¨ìµ{¦¡µ²§ô
        DoEvents '¼È°±°õ¦æ¡A¥H«KÅý§@·~¨t²Î¥i¥H³B²z¨ä¥¦ªº¨Æ¥ó¡C
        Call CloseHandle(pHnd)
    End If
End Sub

        ÀR«ä¦Û¦b : ·O´d¨S¦³¼Ä¤H¡A´¼¼z¤£°_·Ð´o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD