Option Explicit On Option Strict On Module Module1 'Global variables for plotting mileage Public NumValues As Integer Public Dates(100) As String Public Odometer(100) As Single Public Gallons(100) As Single Public RecentMileage(100) As Single, OverallMileage(100) As Single 'API Declares and Constants Public Declare Function GetTickCount Lib "kernel32" () As Integer Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Integer) As Integer Public Const SND_ASYNC As Integer = &H1 ' play asynchronously Public Const SND_SYNC As Integer = &H0 ' play synchronously (default) Public Const SND_MEMORY As Integer = &H4 ' lpszSoundName points to a memory file Public Sub Delay(ByVal D As Single) Dim TimeStart As Single 'Delay for D seconds TimeStart = CSng(Microsoft.VisualBasic.Timer) Do Loop While Microsoft.VisualBasic.Timer - TimeStart < D End Sub Public Sub Shuffle(ByVal NumberOfItems As Integer, ByVal NumberList() As Integer) 'Shuffles integers from 1 to NumberOfItems 'Procedure level variables Dim TempValue As Integer Dim LoopCounter As Integer Dim ItemPicked As Integer Dim Remaining As Integer 'Initialize array For LoopCounter = 1 To NumberOfItems NumberList(LoopCounter) = LoopCounter Next LoopCounter 'Work through Remaining values 'Start at NumberOfItems and swap one value 'at each For/Next loop step 'After each step, Remaining is decreased by 1 For Remaining = NumberOfItems To 2 Step -1 'Pick item at random ItemPicked = CInt(Rnd() * Remaining - 0.5) + 1 'Swap picked item with bottom item TempValue = NumberList(Remaining) NumberList(Remaining) = NumberList(ItemPicked) NumberList(ItemPicked) = TempValue Next Remaining End Sub Public Function AppPath() As String Dim A As String 'Executing file location and name A = Reflection.Assembly.GetExecutingAssembly.Location 'strip off file name A = Mid(A, 1, InStrRev(A, "\")) Return (A) End Function Public Function GetSound(ByVal FileName As String) As String '------------------------------------------------------------ ' Load a sound file into a string variable. ' Taken from: ' Mark Pruett ' Black Art of Visual Basic Game Programming ' The Waite Group, 1995 '------------------------------------------------------------ Dim F As Integer Dim Buffer As String Dim SoundBuffer As String Buffer = Space(1024) SoundBuffer = "" Try F = FreeFile() FileOpen(F, AppPath() + FileName, OpenMode.Binary) 'Get sound in 1K chunks Do While Not EOF(F) FileGet(1, Buffer, , True) SoundBuffer += Buffer Loop Return Trim(SoundBuffer) Catch SoundBuffer = "" Finally FileClose(F) End Try End Function End Module