Understanding Winmm Multimedia DLL


Name: Winmm.dll
Author: Burt Abreu
Date: December 20, 1997

Description: We explore the WINMM multimedia dll for 32 bit windows; we'll see the associated functions declare statements, explain what the parameters mean and show you how to use it with some simple samples. Remember, we'll be covering this at a level for beginner's; there may be other things you'll want to explore at sites geared to more advanced programers.

The Windows 95 Multimedia System consists of low-level and high-level functions. There are a lot more low-level functions than high-level. They allow you to access the device drivers directly and do some other things which the high-level functions cannot; on the downside they require a lot more programming and are more complex. The high-level functions handle some of the more common multimedia tasks and hide the complexity of the low-level interface by sending messages to it and allowing it to perform its wizardry unseen. Sort of the way that Visual Basic is able to hide some of the complexity of the underlying API from us much of the time. For the purposes of our beginners tutorials we will be dealing mostly with the high-level interface. Note: Not all of the multimedia functions live in winmm.dll.
Controls needed: N/A
Level: All Levels.


mciExecute

Description

This function takes a single argument and executes MCI commands.

Declare Statement

#if WIN32 Then
Public Declare Function mciExecute& Lib "winmm.dll" (ByVal lpstrCommand As String)
#else 
Public Declare Function mciExecute% Lib "mmsystem.dll" (ByVal lpstrCommand As String)
#endif

Return Value

Returns a long integer value that indicates success or failure.

Comments

Takes the "Play" command and will open, play and close the called MCI device.

Sample Code

Play Wave or MIDI File


waveOutGetNumDevs

Description

This function will return a 0 if target system supports WAV or a 1 if it does not.

Declare Statement

#if WIN32 Then
Public Declare Function waveOutGetDevCaps& Lib "winmm.dll" Alias "waveOutGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As WAVEOUTCAPS, ByVal uSize As Long)
#else 
Public Declare Function waveOutGetDevCaps% Lib "mmsystem.dll" (ByVal uDeviceID As Integer, lpCaps As WAVEOUTCAPS, ByVal uSize As Integer)
#endif

Return Value

Depending on arguments sent will return an integer value that indicates success or failure, or detailed info about the sound card.

Comments

To use this function simply to see if target system will play wave files you will send it with no parameters; in other words erase everything between ( ); this function can really query the sound card and extract quite a bit of information about it by using the other parameters we've erased. It is beyond my abilities right now; I'll expand the explanation here after I'm sure I understand all the arguments and can produce a decent code sample.

Sample Code

Check if Sound Card will play WAV files.


You may also want to search Microsoft Technical Support for these, and other articles, which relate to winmm.dll. The articles specify which versions of VB they apply to.Just cut and paste the article id and/or description into the search box, I didn't add links for each article since it would be difficult to maintain if they change the location of an article.