Results 1 to 3 of 3

Thread: Smart delaying

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Posts
    25

    Unhappy

    In my program there is a need to do a delay.
    There are few subs that need the delay like:

    Code:
    Sub Kick(Index as integer)
      send index, "You prepare to kick"
      'Here supposed to be a SmartDelay of 3 seconds
      send index, "You kick him"
    End Sub
    
    Sub Punch(Index as integer)
      send index, "You prepare to punch"
      'Here supposed to be a SmartDelay of 5 seconds
      send index, "You punch him"
    End Sub
    I need the code to delay in that places.
    It is important that the code won't stop because of the delay (No do-loop with doevents delays).

    What should I do?
    VitalyB - VB6 Pro

  2. #2
    Guest
    A small little nap?

    Code:
    Private Declare Sub Sleep Lib "kernel32" _
    (ByVal dwMilliseconds As Long)
    
    Call Sleep(1000) '1 second

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Posts
    25

    Unhappy =(

    Thanks but no.
    Sleep freezes the program, the program should be able to call the Punch sub even if it still in a delay of a kick (There will be two delays in this case.

    Do-DoEvents-Loop_Until code is not good only because if you for example starting to Punch while still not finishing kicking then it will go to the other Do-Loop and the kick won't be finished before the punch.
    VitalyB - VB6 Pro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width