Tip:
Because the callback function is accessed during the interruption time, it must be in the DLL; the data to be accessed must be in a fixed data segment;
Postmessage
Timegetsystemtime
Timegettime
Timesetevent
Timekillevent
Midioutshortmsg
Midioutlongmsg
Outputdebugstring cannot be called by other systems.
// Declaration: midiinopen (lphmidiin: phmidiin; {pointer used to return the device handle; then call other functions to use this handle} udeviceid: uint; {Device ID; it cannot be specified as the constant midi_mapper = uint (-1);} dwcallback: DWORD {callback function address or window handle; if the callback mechanism is not used, set it to nil} dwinstance: DWORD {instance data for the callback function; not used in the window} dwflags: DWORD {open option}): mmresult; {0 is returned for success; possible error values can be found below :} mmsyserr_baddeviceid = 2; {Device ID} mmsyserr_allocated = 4; {the specified resource has been allocated} mmsyserr_nomem = 7; {memory cannot be allocated or locked} // optional dwflags value: callback_null = $00000000; {specified when dwcallback is nil} callback_window = $00010000; {When dwcallback is a window handle, specify} callback_function = $00030000; {When dwcallback is a function pointer} // if you select a window to receive callback information, messages that may be sent to the window include: mm_mim_open = $3c1; mm_mim_close = $3c2; mm_mim_data = $3c3; mm_mim_longdata = $3c4; mm_mim_error = $3c5; callback = $3c6; // if you select a function to accept callback information, messages may be sent to the function: mim_open = mm_mim_open; mim_close = mm_mim_close; mim_data = mm_mim_data; mim_longdata = mm_mim_longdata; mim_error = mm_mim_error; mim_longerror = timeout;
// Example: