VB中怎么可以实现像VC中Sleep那样的功能,不用时钟控制!同时让系统进行别的操作!

解决方案 »

  1.   

    但是doevents很难控制具体的时间长度!
      

  2.   

    'Example Name:BlockInput
    Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Private Sub Form_Activate()
        'KPD-Team 2000
        'URL: http://www.allapi.net/
        'E-Mail: [email protected]
        DoEvents
        'block the mouse and keyboard input
        BlockInput True
        'wait 10 seconds before unblocking it
        Sleep 10000
        'unblock the mouse and keyboard input
        BlockInput False
    End Sub
      

  3.   

    '写个延迟函数吧.
    Public Sub Delay(PauseTime As Long)
    Dim Start As Single
    Start = Timer
    Do While Timer < Start + PauseTime
          DoEvents
    Loop
    End Sub'调用的方法delay 3   '这样就延迟了3秒
      

  4.   

    Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
     
    sleep(500)'延时500毫秒
      

  5.   

    Private Sub cmdOK_Click()
          call delay(60)  '60秒
    end sub
    Private Function Delay(ByVal n As Single)
        Dim tm1 As Single
        Dim tm2 As Single
        tm1 = Timer
        Do
           tm2 = Timer
           If tm2 < tm1 Then tm2 = tm2 + 86400
           If tm2 - tm1 > n Then Exit Do
           DoEvents
        Loop
        
    End Function
      

  6.   

    可以使用WINAPI
    Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
     
    sleep(100)'延时100毫秒
      

  7.   

    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)使用API!
      

  8.   

    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    这个就可以了。
      

  9.   


    http://www.netyi.net/in.asp?id=wuyaxlz