The application can specify exclusive access, which inhibits other applications from acquiring use of the device until released by the owning application.

When a device is opened by an application, the physical device resource is acquired automatically by the newly created device instance. If the device instance subsequently loses use of the physical resource, it can regain use later by issuing MCI_ACQUIREDEVICE. This message enables applications to participate in a device-sharing scheme, driven by WM_ACTIVATE message processing, wherein the use of physical devices generally is granted to the application with which the user is interacting by the application issuing MCI_ACQUIREDEVICE.

If a defined device instance loses use of the physical device to other device instances, that use is regained when the other device instances are closed, even if MCI_ACQUIREDEVICE is not issued.

When a process acquires use of a shared device that currently is in use by another process, the device instance is saved for the previous process.

Applications receive the MM_MCIPASSDEVICE message whenever they gain or lose use of a device. Use of a device is not obtained until the MM_MCIPASSDEVICE message is received. This message is posted (by way of WinPostMsg) to the window handle specified in the hwndCallback field on the MCI_OPEN message. If an invalid or no hwndCallback parameter is provided on the MCI_OPEN message, then no MM_MCIPASSDEVICE messages are received.

If the device has been acquired exclusively by another device instance, the function returns MCIERR_DEVICE_LOCKED.


[Back] [Next]