All MCI command tables must include the MCI_WAIT flag for all commands. Applications use this flag to request the driver to complete the operation before returning control to the application.
When an MCI driver receives a command, by default it should start the operation and then return control to the calling application. The driver should not wait for the operation to complete before returning. For example, if an application sends an MCI_SEEK command, the driver should start the seek operation and immediately return.
Optionally, an application sending any MCI command can request the driver to wait until the associated operation is complete before returning. The application makes this request by including the MCI_WAIT flag as a command argument.
The driver receives the MCI_WAIT flag in the lParam1 argument to DriverProc. If the flag is present, then the driver must initiate the requested operation and then wait for it to complete before returning.
Yielding
Since the waiting time can be potentially long, a user must be allowed to interrupt the operation. By default, MCI provides a yield routine that checks for a break key. The default break key is ctrl+break. An application can change the break key by sending the MCI_BREAK command. It can also replace the default yield routine with a customized one by calling the mciSetYieldProc function in winmm.dll. The yield routine returns a nonzero value if the driver should terminate the current operation.
While the driver is waiting for the requested operation to complete, it must periodically call the mciDriverYield function in winmm.dll. This function calls the currently selected yield routine and returns its return value. If this value is nonzero, the driver must stop the operation.