MCI_STATUS
Appearance
This message is used to obtain information about the status of a device instance. MCI_STATUS returns the values most recently set by MCI_SET, MCI_LOAD, MCI_SETTUNER, and MCI_SETIMAGEBUFFER operations.
Syntax
param1 ULONG ulParam1; /* Message flags. */ param2 PMCI_STATUS_PARMS pParam2; /* Pointer to status structure. */
Parameters
- ulParam1 (ULONG) - input
- The following flags can be used:
- MCI_NOTIFY Posts a notification message when the action completes.
- MCI_WAIT Does not return control until the action is completed.
- MCI_STATUS_START Returns the starting position of the media. Must specify `MCI_STATUS_POSITION` in the `ulItem` field.
- MCI_TRACK Includes a status track parameter in `ulTrack`. Used with `MCI_STATUS_POSITION` (start of track) or `MCI_STATUS_LENGTH` (length of track).
- MCI_STATUS_CONNECTOR Queries specific audio settings for the connector specified in `ulValue`. Mutually exclusive with `MCI_STATUS_ITEM`.
- MCI_STATUS_ITEM Indicates `ulItem` contains a constant specifying the status item to query.
- ulItem Constants (General)
-
- MCI_STATUS_AUDIO Queries audio channel status. Specify `MCI_STATUS_AUDIO_ALL`, `MCI_STATUS_AUDIO_LEFT`, or `MCI_STATUS_AUDIO_RIGHT` in `ulValue`.
- MCI_STATUS_CAN_PASTE Returns `MCI_TRUE` if compatible data is in the clipboard.
- MCI_STATUS_CAN_REDO / CAN_UNDO Returns `MCI_TRUE` if undo/redo is available.
- MCI_STATUS_CLIPBOARD Returns `MCI_TRUE` if clipboard info is understood by the device.
- MCI_STATUS_CURRENT_TRACK Returns the current track/segment/chapter number.
- MCI_STATUS_LENGTH Returns total media length in current time format.
- MCI_STATUS_MODE Returns current device mode: `MCI_MODE_NOT_READY`, `PAUSE`, `PLAY`, `STOP`, `RECORD`, or `SEEK`.
- MCI_STATUS_MEDIA_PRESENT Returns `MCI_TRUE` if media is inserted (for removable media).
- MCI_STATUS_NUMBER_OF_TRACKS Returns total tracks/chapters.
- MCI_STATUS_POSITION Returns the current position.
- MCI_STATUS_POSITION_IN_TRACK Returns position relative to track start.
- MCI_STATUS_READY Returns `MCI_TRUE` if device is ready.
- MCI_STATUS_TIME_FORMAT Returns current time format (e.g., `MCI_FORMAT_MILLISECONDS`).
- MCI_STATUS_VIDEO Returns `MCI_TRUE` if video is enabled.
- MCI_STATUS_VOLUME Returns volume (Low word: Left, High word: Right).
- pParam2 (PMCI_STATUS_PARMS) - input/output
- A pointer to an MCI_STATUS_PARMS structure. Device-specific drivers (like CD-XA) may use PMCI_CDXA_STATUS_PARMS.
Returns
- rc (ULONG) - returns
-
- MCIERR_SUCCESS Command completed successfully.
- MCIERR_INDETERMINATE_LENGTH Media length cannot be determined.
- MCIERR_TUNER_NO_HW No tuner support.
- MCIERR_TUNER_MODE Frequency set directly; cannot query channel/finetune. Use `MCI_DGV_STATUS_FREQUENCY`.
- MCIERR_SIGNAL_INVALID No valid signal present.
Remarks
- **Time Formats:** If the time format is `MCI_FORMAT_TMSF`, `MCI_STATUS_LENGTH` returns data in `MCI_FORMAT_MSF`.
- **Volume:** Volume levels are returned as percentages.
- **Dropped Frames:** Digital Video devices can query `MCI_DGV_STATUS_DROPPED_FRAME_PCT` to monitor performance during record/play.
- **Tuner:** Use `MCI_DGV_STATUS_TUNER_TV_CHANNEL` to see the current channel.
- **Mixer:** Use `MCI_AMP_STATUS_BALANCE`, `BASS`, `TREBLE`, or `GAIN` for audio hardware settings.
Example Code
The following code queries the current position of the media.
USHORT usDeviceID;
MCI_STATUS_PARMS mciStatusParms;
mciStatusParms.ulItem = MCI_STATUS_POSITION;
mciSendCommand( usDeviceID,
MCI_STATUS,
MCI_WAIT | MCI_STATUS_ITEM,
(PVOID) &mciStatusParms,
0);
/* mciStatusParms.ulReturn now contains the current position */