Export (0) Print
Expand All

close

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 Values

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.

The following command closes the "mysound" device:

close mysound

Windows 98/Me, 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.

Windows Vista: Closing the cdaudio device stops audio playback.

Requirements

  Windows NT/2000/XP: Included in Windows NT 3.1 and later.
  Windows 95/98/Me: Included in Windows 95 and later.

See Also

MCI, MCI Command Strings

Show:
© 2014 Microsoft