其實播放vcd就是播放\mpegav下的*.dat文件.請看下面的代碼.
procedure TForm1.check;
var
filename:array[0..20]:string;
i,err:integer;
rs:tsearchrec;
begin
err:=findfirst('e:\mpegav\*.dat',faanyfile,rs);
while err=0 do
begin
if rs.Name[1]<>'.' then
begin
filenames[i]:='e:\mpegav\'+rs.name;
err:=findnext(rs);
end;
end;
if i>1 then
begin
vcdplay.FileName:=filenames[1];
try
vcdplay.open;
vcdplay.play;
except
showmessage('恅璃跡宒渣昫');
end;
end
else showmessage('羶衄VCD嫖詠');
end;
Function TForm1.AudioCD(Drive : Char) : Boolean;
Var
FSFlags, MaxLength: DWORD;
VolName, Path : String;
Begin
Path := Drive + ':\';
Result := FALSE;
if (GetDriveType(PChar(Path)) = DRIVE_CDROM) then
Begin
SetLength(VolName, 64);
GetVolumeInformation(PChar(Path), PChar(VolName), Length(VolName), nil, MaxLength, FSFlags, nil,0);
if (lStrCmp(PChar(VolName),'Audio CD') = 0) Then Result := TRUE;
End;
end;