Windows Mobile 6.5
A version of this page is also available for

This function opens a specified waveform output device for playback.

MMRESULT waveOutOpen(
  UINT uDeviceID,
  DWORD dwCallback,
  DWORD dwInstance,
  DWORD fdwOpen


Address filled with a handle identifying the open waveform-audio output device. Use the handle to identify the device when calling other waveform-audio output functions. This parameter might be NULL if the WAVE_FORMAT_QUERY flag is specified for fdwOpen.


Device identifier of the waveform-audio output device to open. You can use the following flag instead of a device identifier.

Value Description


The function selects a waveform-audio output device capable of playing the specified format.


Pointer to a WAVEFORMATEX (Waveform Audio) structure that identifies the format of the waveform-audio data to be sent to the device. You can free this structure immediately after passing it to waveOutOpen.


Specifies the address of a fixed callback function, an event handle, a handle to a window, or the identifier of a thread to be called during waveform-audio playback to process messages related to the progress of the playback. If no callback function is required, this value can be zero.


Specifies user-instance data passed to the callback mechanism. This parameter is not used with the window callback mechanism.


Flags for opening the device. The following table shows the possible values.

Value Description


The dwCallback parameter is an event handle.


The dwCallback parameter is a callback procedure address.


No callback mechanism. This is the default setting.


The dwCallback parameter is a thread identifier.


The dwCallback parameter is a window handle.


If this flag is specified, a synchronous waveform-audio device can be opened. If this flag is not specified while opening a synchronous driver, the device will fail to open.


If this flag is specified, the ACM driver does not perform conversions on the audio data.


If this flag is specified, waveOutOpen queries the device to determine if it supports the specified format, but the device is not actually opened.


If this flag is specified, the uDeviceID parameter specifies a waveform-audio device to be mapped to by the wave mapper.

One of the values described in the following table is returned.

Value Description




Specified device handle is invalid.


Specified device identifier is out of range.


No device driver is present.


Unable to allocate or lock memory.


Attempted to open with an unsupported waveform-audio format.


Device is synchronous but waveOutOpen was called without using the WAVE_ALLOWSYNC flag.

The waveOutOpen function creates device instance handles that the other waveform output API functions (for example, waveOutWrite) use to distinguish one audio stream from another. Audio devices that support hardware mixing can allow multiple device instances to be created and played at the same time.

In addition, Windows Embedded CE offers software mixing of multiple audio streams. When an application calls waveOutOpen, the waveform API manager routes the request to the device driver, if it supports hardware mixing, or the software mixer otherwise.

Use the waveOutGetNumDevs function to determine the number of waveform-audio output devices present in the system. If the value specified by the uDeviceID parameter is a device identifier, it can vary from zero to one less than the number of devices present. The WAVE_MAPPER constant can also be used as a device identifier.

The structure pointed to by pwfx can be extended to include type-specific information for certain data formats by using the WAVEFORMATEX (Waveform Audio) structure to specify the length of the additional data.

If you choose to have a window or thread receive callback information, the following messages are sent to the window procedure function to indicate the progress of waveform-audio output: MM_WOM_OPEN, MM_WOM_CLOSE, and MM_WOM_DONE.

If you choose to have a function receive callback information, the following messages are sent to the function to indicate the progress of waveform-audio output: WOM_OPEN, WOM_CLOSE, and WOM_DONE.

Notifications for event callbacks are triggered when one or more buffers are sent back to the application. This is the same condition that would generate a MM_WOM_DONE message for a window callback or a WOM_DONE message for a function callback.

Windows Embedded CEWindows CE 2.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions