The following code illustrates how an application can acquire a device.
MCI_GENERIC_PARMS mciGenericParms; /* Info data structure for cmd */
USHORT usDeviceID; /* Device ID */
HWND hwndMyWindow; /* Handle to the PM window */
MPARAM mp1; /* Message parameter passed */
on window procedure message */
/* Assign hwndCallback the handle to the PM window routine */
mciGenericParms.hwndCallback = hwndMyWindow;
/* Acquire the device if our window is being activated. */
if ((BOOL)mp1)
{
mciSendCommand(usDeviceID, /* Requested device */
MCI_ACQUIREDEVICE, /* MCI acquire device message */
MCI_NOTIFY, /* Flags for this message */
(PVOID)&mciGenericParms,
/* Parameter data structure */
0); /* No user parameter for */
/* notification message */
}