|
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 command specifies an MCI command, such as open, close, or play.
- The device_id identifies an instance of an MCI driver. The device_id is created when the device is opened.
- The arguments specify the flags and variables used by the command. Flags are keywords
recognized with the MCI command. Variables are numbers or strings that apply to the
MCI command or flag.
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);
}
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
More Online Helps
Win32 Programmer's Reference (win32.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|