Syntax of Command Strings

MCI command strings use a consistent verb-object-modifier syntax. Each command string includes a command, a device identifier, and command arguments. Arguments are optional for some commands and required for others.

A command string has the following form:

command device_id arguments

These components contain the following information:

The following example function sends the play command with the "from" and "to" flags.

DWORD PlayFromTo(LPSTR lpstrAlias, DWORD dwFrom, DWORD dwTo) 
{ 
    char achCommandBuff[128]; 

    // Form the command string.
    wsprintf(achCommandBuff, "play %s from %u to %u", 
        lpstrAlias, dwFrom, dwTo); 

    // Send the command string.
    return mciSendString(achCommandBuff, NULL, 0, NULL); 
}