我想让一个进程在一个点停上两秒再继续执行,该怎么办?

解决方案 »

  1.   

    进程挂起: SLEEP 2000延时但不挂起: DELAY 2000=================================================
    Public Sub Delay(mSec As Long)
        On Error GoTo ShowErr
        
        Dim TStart  As Single
        
        TStart = Timer
        
        While (Timer - TStart) < (mSec / 1000)
            DoEvents
        Wend
        Exit Sub
    ShowErr:
        MsgBox Err.Source & "------" & Err.Description
        Exit SubEnd Sub
      

  2.   

    Sleep或WaitForSingleObject都 行。
      

  3.   

    'This project needs a button
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Private Sub Command1_Click()    Me.Caption = "Your system will sleep 5 sec."
        'Sleep for 2000 milliseconds
        Sleep 2000
        Me.Caption = ""
    End Sub
    Private Sub Form_Load()
        Me.Caption = ""
        Command1.Caption = "Sleep ..."
    End Sub