close command

The close command closes the device or file and any associated resources. MCI unloads a device when all instances of the device or all files are closed. All MCI devices recognize this command.

To send this command, call the mciSendString function with the lpszCommand parameter set as follows.

_stprintf_s(
  lpszCommand, 
  TEXT("close %s %s"), 
  lpszDeviceID, 
  lpszFlags
); 

Parameters

lpszDeviceID

Identifier of an MCI device. This identifier or alias is assigned when the device is opened.

lpszFlags

Can be "wait", "notify", or both. For more information about these flags, see The Wait, Notify, and Test Flags.

Return Value

Returns zero if successful or an error otherwise.

Remarks

To close all devices opened by your application, specify the "all" device identifier for the lpszDeviceID parameter.

Closing the cdaudio device stops audio playback.

Windows 2000/XP: If the cdaudio device is playing, closing the cdaudio device does not cause the audio to stop playing. Send the stop command first.

Examples

The following command closes the "mysound" device.

close mysound

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Header
Corecrt_io.h

See also

MCI

MCI Command Strings