例えば、MCIをオープンするソースは以下のようです。
{MCIをオープン}
function OpenMCI(var MpSts: MPStatus): Boolean;
var
OpenParms: Tmci_Open_Parms;//オープンの為の構造体
begin
{mci_Notifyを返すウインドウズハンドル}
OpenParms.dwCallback := MpSts.WHand;
{デバイスタイプでオープンモードを決定 例:CDAudio}
OpenParms.lpstrDeviceType := DeviceName[MpSts.DeviceType];
{ファイルの拡張子でオープンモードを決定 例:sampl.wav}
OpenParms.lpstrElementName := PChar(MpSts.FileName);
{ファイルの拡張子でオープンモードを決める場合Flagsはmci_Open_Elementで
DeviceType:=Null}
if MpSts.DeviceType = mpAutoSelect then
mpFlags := mci_Notify or mci_Wait or mci_Open_Element
{デバイスタイプでオープンモードを決める場合Flagsはmci_Open_Type}
else begin
mpFlags := mci_Notify or mci_Wait or mci_Open_Type;
{デバイスタイプがあってもファイル名ある場合とRecordはmci_Open_Element}
if (MpSts.Status = stRecord) or (MpSts.FileName <> '') then
mpFlags := mpFlags or mci_Open_Element;
end;
mpError := mciSendCommand(0, mci_OPEN, mpFlags, LongInt(@OpenParms));
{エラーした場合}
if mpError <> 0 then begin
ErrorMsgOut(mpError);
Result := False;
end
{成功した場合DeviceIDを保存}
else begin
MpSts.DeviceID := OpenParms.wDeviceID;
Result := True;
end;
end;