Setting the Time Format
[The feature associated with this page, MCI, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of MCI, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
Use the MCI_SET command message along with the MCI_SET_PARMS structure to set the time format for an open device. Set the dwTimeFormat member to one of the following constants.
Constant | Time format |
---|---|
MCI_FORMAT_BYTES | Bytes (in pulse code modulated [PCM] format files) |
MCI_FORMAT_MILLISECONDS | Milliseconds |
MCI_FORMAT_MSF | Minute/second/frame |
MCI_FORMAT_SAMPLES | Samples |
MCI_FORMAT_SMPTE_24 | SMPTE, 24 frame |
MCI_FORMAT_SMPTE_25 | SMPTE, 25 frame |
MCI_FORMAT_SMPTE_30 | SMPTE, 30 frame |
MCI_FORMAT_SMPTE_30DROP | SMPTE, 30 frame drop |
MCI_FORMAT_TMSF | Track/minute/second/frame |
MCI_SEQ_FORMAT_SONGPTR | MIDI song pointer |
The following example sets the time format to milliseconds on the device specified by the wDeviceID variable using the mciSendCommand function.
UINT wDeviceID;
MCI_SET_PARMS mciSetParms;
// Set time format to milliseconds.
mciSetParms.dwTimeFormat = MCI_FORMAT_MILLISECONDS;
if( mciSendCommand(wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT,
(DWORD) &mciSetParms))
{
// Error, unable to set time format.
return FALSE;
}
else
{
// Time format set successfully.
return TRUE;
}