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:
For example, the play command uses the arguments "from position" and "to position" to indicate the positions at which to start and end play. You can list the flags used with a command in any order. When you use a flag that has a variable associated with it, you must supply a value for the variable.
Unspecified (and optional) command arguments assume a default value.
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);
}