Handling DRV_OPEN

When winmm.dll sends the DRV_OPEN message, it sets the DriverProc parameters as follows:

dwDriverID

Zero.

hDriver

The driver’s handle.

uMsg

DRV_OPEN.

lParam1

Contains a pointer to a zero-terminated string. The string contains any characters that follow the filename in the system registry.

lParam2

Pointer to an MCI_OPEN_DRIVER_PARMS structure.

The value of the lpstrParams member of MCI_OPEN_DRIVER_PARMS is the same as the value of lParam1.

Before DriverProc returns, you must:

·Set the wCustomCommandTable member of MCI_OPEN_DRIVER_PARMS. If the driver is using a custom command table, this member must contain the handle returned by mciLoadCommandResource. Otherwise use MCI_NO_COMMAND_TABLE, defined in mmddk.h.

·Set the wType member of MCI_OPEN_DRIVER_PARMS to one of the defined MCI device types. If the device does not belong to any of the defined types, use MCI_DEVTYPE_OTHER.

·Assign the DriverProc function’s return value to be the contents of the wDeviceID member of MCI_OPEN_DRIVER_PARMS. However, if you encounter errors during the process of opening the device, you should assign a return value of zero instead.

The driver can also perform instance-specific operations for the device being opened.