MODM_OPEN

The MODM_OPEN message is sent to a MIDI output driver to request it to open an instance of a specified device.

Parameters

uDeviceId

Device identifier (0, 1, 2, and so on) for the target device.

uMsg

MODM_OPEN

dwUser

Pointer to location to receive device instance identifier.

dwParam1

Pointer to a MIDIOPENDESC structure, containing the client's device handle, notification target, and instance ID.

dwParam2

Contains flags. The following flags are defined.

Flag Definition
CALLBACK_EVENT Indicates dwCallback member of MIDIOPENDESC is an event handle.
CALLBACK_FUNCTION Indicates dwCallback member of MIDIOPENDESC is the address of a callback function.
CALLBACK_TASK Indicates dwCallback member of MIDIOPENDESC is a task handle.
CALLBACK_WINDOW Indicates dwCallback member of MIDIOPENDESC is a window handle.

Return Value

The driver should return MMSYSERR_NOERROR if the operation succeeds. Otherwise it should return one of the MMSYSERR or MIDIERR error codes defined in mmsystem.h. See midiOutOpen return values in the Win32 SDK.

Comments

A client sends the MODM_OPEN message by calling the user-mode driver's modMessage entry point, passing the specified parameters.

Typically, user-mode drivers connect to kernel-mode drivers by calling CreateFile, specifying the MS-DOS device name of one of the kernel-mode driver's devices.

The driver assigns a device instance identifier and returns it in the location pointed to by dwUser. The driver can expect to receive this value as the dwUser input argument to all other modMessage messages.

The driver determines the number of clients it allows to use a particular device. If a device is opened by the maximum number of clients, it returns MMSYSERR_ALLOCATED for subsequent open requests.

If the open operation succeeds, the driver should send the client a MOM_OPEN message by calling the DriverCallback function.

For additional information, see Transferring MIDI Output Data.