![]() |
API GetTickCount and API for sound
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 |
API GetTickCount and API for sound
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 "Prasad Vanka" wrote in message om... 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 |
All times are GMT +1. The time now is 07:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com