Results 1 to 4 of 4

Thread: Wait command, like 2 seconds?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Location
    Pennsylvania
    Posts
    11
    I am opening an NTVDM DOS window using VB 6 via shell. Then SendKeys to that window, however the dang keys are getting there too fast sometimes (ie Send Keys "ping etc etc etc" and instead of PING just NG gets there). I have the wait value set to true but it still gets there too fast. Is there anyway to set a pause before the Send Keys? I tried setting AppActivate to True but that errors out, so I'm not sure if that will work...any thoughts?
    Chris
    Systems Analyst
    Visual Studio 6 Enterprise SP1 (VB6)

  2. #2
    Guest
    use this little pause sub that I wrote

    Code:
    'in a module
    Public Sub Pause(Duration As Double)
        Dim Current As Long
        Current = Timer
        Do Until Timer - Current >= Duration
            DoEvents
        Loop
    End Sub
    'in command button
    Pause 2


  3. #3
    Lively Member
    Join Date
    May 1999
    Location
    KC
    Posts
    72

    Arrow API?

    There's a 'sleep' API that might help. Paste this in the Declares section:
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

    Just call:
    Sleep 2000
    to wait 2 seconds (2000 milliseconds)

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Location
    Pennsylvania
    Posts
    11

    Smile

    Thanks both worked!
    Chris
    Systems Analyst
    Visual Studio 6 Enterprise SP1 (VB6)

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