API GetTickCount and API for sound

  • Thread starter Thread starter Prasad Vanka
  • Start date Start date
P

Prasad Vanka

Hi,

Declare Function GetTickCount& Lib "Kernel32"

The above API function returns the no. of milli seconds since the
sytem was booted.

Can someone provide me a simple code to use the above function to
simulate a stopwatch. Also, in the same code snippet, can you use an
API for sound and any other API's.

This way I will get an idea how to use API's in VB programs.

Thanks in advance.
Prasad Vanka
 
Prasad,

You can use GetTickCount in the following manner:

Dim StartTicks As Long
Dim EndTicks As Long
StartTicks = GetTickCount()
' more code here
EndTicks = GetTickCount()
MsgBox EndTicks - StartTicks

You can play WAV files with code like the following:

Declare Function sndPlaySound32 Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Sub PlaySound()
sndPlaySound32 "chimes.wav", 0
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top