The MIDM_OPEN message is sent to a MIDI input 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
MIDM_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_WINDOW | Indicates the dwCallback member of MIDIOPENDESC is a window handle. |
CALLBACK_FUNCTION | Indicates the dwCallback member of MIDIOPENDESC is the address of a callback function. |
CALLBACK_TASK | Indicates the dwCallback member of MIDIOPENDESC is a task handle. |
MIDI_IO_STATUS | Indicates the client wants to receive MIM_MOREDATA callback messages. |
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 midiInOpen return values in the Win32 SDK.
Comments
A client sends the MIDM_OPEN message by calling the user-mode driver’s midMessage 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 midMessage 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 MIM_OPEN message by calling the DriverCallback function.
For additional information, see Transferring MIDI Input Data.