[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Delay an application

Posted on 2003-03-14
6
Medium Priority
?
482 Views
Last Modified: 2013-12-26
Hi!

I need to remote SAP by using the sendkey command. Since SAP needs some time to get the specified data - I need to create a pause before I can continue sending the other keys... Can you tell me how I can do that? I don't think it's difficult but I just don't get it at the moment...
0
Comment
Question by:Venio
  • 3
  • 2
6 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 8135172
Hi Venio,

There is an api call which is best suited to this task:

Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

Then when you want to wait:

Sleep 5000 'Wait for 5 seconds

Tim Cottee MCSD, MCDBA, CPIM
http://www.timcottee.tk 

Brainbench MVP for Visual Basic
http://www.brainbench.com

Experts-Exchange Advisory Board Member
0
 

Author Comment

by:Venio
ID: 8135185
I've tried sleep before but it didn't work... I have added the Source Code... maybe I've done something wrong (I'm totally new to VB)

Private Sub Command2_Click()
Dim i, j As Long
SendKeys "%{tab}"
For i = 0 To (List1.ListCount - 1)
    SendKeys "{Tab}"
    SendKeys "{Tab}"
    SendKeys List1.List(i)
    SendKeys "{F8}"
    Sleep (1000)
    SendKeys "~"
    SendKeys "^(+{F7})"
Next
End Sub
0
 
LVL 1

Accepted Solution

by:
Ysgrathe earned 200 total points
ID: 8135238
Venio,
if you just want vb to waste a little time you could set up a little time wasting loop...

before the flames start coming in, i know it isnt efficient useage of processor time, etc, but it works in appropriate situations where the client pc just has to wait for a short time for a network based process to catch up and the client doesnt have too much else to do in the mean time, and is totally VB.

Private Sub WasteTime(intSeconds as integer)
Dim x As Date
x = DateAdd("s", intSeconds , Now())

While Now() < x
    DoEvents
Wend

End Sub

its quick, its dirty, but it works.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 

Author Comment

by:Venio
ID: 8135650
das hat mir geholfen! Vielen Dank!
0
 
LVL 1

Expert Comment

by:Ysgrathe
ID: 8142346
Sie sind willkommen.
0
 

Author Comment

by:Venio
ID: 8150169
;-) now it's out: I'm from Germany...
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

640 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question