An application can set a wait or a notify flag on a device command sent with mciSendString or mciSendCommand. These two flags are mutually exclusive and are available on all commands except some system commands.
┌───────────────┬─────────────────────────────────────────────┐ │Flag │Description │ ├───────────────┼─────────────────────────────────────────────┤ │wait │The command is executed synchronously. The │ │ │function waits until the requested action is │ │ │complete before returning to the application.│ ├───────────────┼─────────────────────────────────────────────┤ │notify │The command is executed asynchronously, │ │ │allowing control to be returned immediately │ │ │to the application. When the requested │ │ │action is complete, an MM_MCINOTIFY message │ │ │is sent to the application window procedure. │ └───────────────┴─────────────────────────────────────────────┘
Note: If a command is issued without a wait flag or notify flag specified, the command is executed asynchronously, and the application is never notified.
The wait flag is useful for operations that are conducted quickly, like the playback of short sounds, which the application wants to complete before it continues. The wait flag is also useful for operations that return information, such as device capabilities, because the Media Device Manager parser converts the return code to a meaningful string. However, the conversion occurs only if the wait flag is specified.
The wait flag should be used with care when issuing commands from threads that read application input message queues as it ties up the thread, preventing all PM messages in the system from being processed while the command issued with the wait flag is executed.
The notify flag is useful for operations that are conducted over a period of time. For example, the playing of a waveform file often can take a while to complete. By specifying the notify flag, an application requests to be notified when processing of the command is complete. The application window procedure can then remain responsive to input queue processing.