var
dwFlags: LongInt;
DeviceID: Word;
PlayParms: TMCI_PLAY_PARMS;
procedure TForm1.MIDIObject;
var
MCIError: Integer;
OpenParms: TMCI_OPEN_PARMS;
SetParms: TMCI_SET_PARMS;
begin
with OpenParms
do
begin
dwCallback:=
Handle;
// TForm1.Handle
lpstrDeviceType:=PChar('
Sequencer');
lpstrElementName:=PChar(FileName);
end;
dwFlags:=MCI_OPEN_ELEMENT
or MCI_OPEN_TYPE;
MCIError:=MCISendCommand(0, MCI_OPEN, dwFlags, Longint(@OpenParms));
If MCIError = 0
then DeviceID:=OpenParms.wDeviceID;
If DeviceID <> 0
then
begin
dwFlags:=MCI_SET_TIME_FORMAT;
SetParms.dwCallback:=
Handle;
// TForm1.Handle
SetParms.dwTimeFormat:=MCI_FORMAT_MILLISECONDS;
MCISendCommand(DeviceID, MCI_SET, dwFlags, Longint(@SetParms));
end;
PlayParms.dwCallback:=MCI_NOTIFY;
MCIError:=MCISendCommand(DeviceID, MCI_PLAY, MCI_NOTIFY, LongInt(@PlayParms));
end;