Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

WaitVBL in VB5 ???

Posted on 1998-02-18
8
Medium Priority
?
270 Views
Last Modified: 2009-07-29
I'm attempting to write a game in Visual Basic 5.
I need to ensure the game play rate is consistent and not too fast. I used to use Blitz Basic 2 on the Amiga and it had a "WaitVBL" command that was used to wait for the screens next complete vertical blank. Is this possible to achieve this with VB 5 ? If not, is it possible to ensure that a game will play at roughly the same speed on (say ) a P133 and a PII 233 ? Obviously, FOR... NEXT loops are not acceptable ;) I notice other games have been written with VB5, so somebody else must have overcome this very problem.
0
Comment
Question by:lbowers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 6

Expert Comment

by:anthonyc
ID: 1457394
You can use SLEEP API (see below) to pause things for a desired number of milliseconds.  You can also use DOEVENTS to have windows complete actions in it's queue, to slow down your game.

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

0
 

Author Comment

by:lbowers
ID: 1457395
Edited text of question
0
 
LVL 3

Expert Comment

by:rmichels
ID: 1457396
Unfortunately I don't think either Sleep or DoEvents will provide predictable periods.  Generally they provide a delay for a minimum amount of time, but exactly how long after that minimum it variable.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:lbowers
ID: 1457397
You're right - I've tried using both of the prviously mentioned solutions and they both vary wildly on the actual time they delay for. It looks like it's not going to be possible with delving into Direct X perhaps...
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1457398
SLEEP API delays for the number of milliseconds you specify.  Nothing more, nothing less.
0
 

Author Comment

by:lbowers
ID: 1457399
Anthony...

Sorry - You were right. The SLEEP API work perfectly!

How do I award you the points as I don't seem to be able to!
I can see no grading options either...
0
 
LVL 6

Accepted Solution

by:
anthonyc earned 1200 total points
ID: 1457400
You can give me points now!
0
 

Author Comment

by:lbowers
ID: 1457401
Thanx a million!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

705 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