04-02-2004, 08:44 AM
How do i use the API functions in VB. Where do I get them. How do i select them??
04-02-2004, 09:21 AM
You have to declare them first:
' the PlaySound API function declaration
Public Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
' you might also need to declare some constants
Public Const SND_ASYNC = &H1 ' play asynchronously
Public Const SND_FILENAME = &H20000 ' name is a file name
Public Const SND_NOWAIT = &H2000 ' don't wait if the driver is busy
and then you can use them as a normal VB function:
' now we can play sounds!
PlaySound GetAppPath & "/sounds/somesound.wav", CLng(0), SND_ASYNC + SND_FILENAME + SND_NOWAIT
The VB 6 API Viewer is a useful tool to find all the appropiate declarations (for the functions, the types, and the constants). You can reach it from the Add-In Manager (In the Add-Ins menu).
PS: I'm talking VB 6 here, I don't know how it goes in VB.NET
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.