Solved

WaitVBL in VB5 ???

Posted on 1998-02-18
8
266 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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 300 total points
ID: 1457400
You can give me points now!
0
 

Author Comment

by:lbowers
ID: 1457401
Thanx a million!
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using "ScreenUpdating" 6 88
MS Date Picker 64 bit 32 bit issue 12 73
VB6 - Convert HH:MM into Decimal 8 78
How to measure sizes and angles in scanned images ? 3 100
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

752 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