CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Pause for a 1/100 or maybe even 1/1000 of a second

    this code

    Sub Pause(interval)

    Current = Timer
    Do While Timer - Current < Val(interval)
    DoEvents
    Loop
    End Sub



    that I picked up somewhere on internet is sucky, it stops like for longer then I need it to, even if I use Pause 0.001 it stops same as long as 0.01 or maybe even same as 0.1, code is not very good for my program....can someone help me pause for very very short time

    Thank You


  2. #2

    Re: Pause for a 1/100 or maybe even 1/1000 of a second

    Try using Sleep API function. This is supposed to take milliseconds as a parameter. I don't know how well it works at this level, but it is supposed to theoretically.

    See http://www.freevbcode.com/ShowCode.Asp?ID=74 for example.


  3. #3
    Join Date
    Sep 1999
    Posts
    11

    Re: Pause for a 1/100 or maybe even 1/1000 of a second

    use this below option explicit
    Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

    where u want to pause execution use

    sleep(no of milliseconds)
    e.g. sleep(100)

    It will pause for 100 millisecont

    Please write me back about responce
    Thanks
    Arun([email protected])


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

Featured