home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH5 / SRC / BOUNCE2.BAS < prev    next >
Encoding:
BASIC Source File  |  1997-01-08  |  1.9 KB  |  49 lines

  1. Attribute VB_Name = "WaitFuncs"
  2. Option Explicit
  3.  
  4. #If Win32 Then  ' 32-bit VB.
  5.     Type BITMAP ' 24 bytes
  6.         bmType As Long
  7.         bmWidth As Long
  8.         bmHeight As Long
  9.         bmWidthBytes As Long
  10.         bmPlanes As Integer
  11.         bmBitsPixel As Integer
  12.         bmBits As Long
  13.     End Type
  14.     Global Const BITMAP_SIZE = 24
  15.     Declare Function GetBitmapBits Lib "gdi32" (ByVal hBitmap As Integer, ByVal dwCount As Long, lpBits As Any) As Long
  16.     Declare Function SetBitmapBits Lib "gdi32" (ByVal hBitmap As Integer, ByVal dwCount As Long, lpBits As Any) As Long
  17.     Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
  18.     Declare Function GetTickCount Lib "kernel32" () As Long
  19. #Else           ' 16-bit VB.
  20.     Type BITMAP ' 14 bytes
  21.         bmType As Integer
  22.         bmWidth As Integer
  23.         bmHeight As Integer
  24.         bmWidthBytes As Integer
  25.         bmPlanes As String * 1
  26.         bmBitsPixel As String * 1
  27.         bmBits As Long
  28.     End Type
  29.     Global Const BITMAP_SIZE = 14
  30.     Declare Function GetBitmapBits Lib "GDI" (ByVal hBitmap As Integer, ByVal dwCount As Long, lpBits As Any) As Long
  31.     Declare Function SetBitmapBits Lib "GDI" (ByVal hBitmap As Integer, ByVal dwCount As Long, lpBits As Any) As Long
  32.     Declare Function GetObject Lib "GDI" (ByVal hObject As Integer, ByVal nCount As Integer, lpObject As Any) As Integer
  33.     Declare Function GetTickCount Lib "User" () As Long
  34. #End If
  35.  
  36. ' ************************************************
  37. ' Pause until GetTickCount shows the indicated
  38. ' time. This is accurate to within one clock tick
  39. ' (55 ms), not counting variability in DoEvents
  40. ' and Windows itself.
  41. ' ************************************************
  42. Sub WaitTill(next_time As Long)
  43.     Do
  44.         DoEvents
  45.     Loop While GetTickCount() < next_time
  46. End Sub
  47.  
  48.  
  49.