May
27
mciSendCommand
15:43var
OpenStruct : TMCI_OPEN_PARMS;
MciPlayParm : TMCI_PLAY_PARMS;
HAVI : Word;
procedure TForm1.FormCreate(Sender: TObject);
begin
OpenStruct.lpstrElementName := pchar(MyMidi); // loaded from HDD
mciSendCommand(0, MCI_OPEN, MCI_OPEN_element, LongInt(@OpenStruct));
HAVI := OpenStruct.wDeviceID;
Button1.Caption := 'Play';
Button2.Caption := 'Stop';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
mciSendCommand(HAVI, MCI_PLAY, 0, Longint(@MciPlayParm));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
mciSendCommand(HAVI, MCI_STOP, 0, 0);
end;