放CD(20)(20分)

W

walala

Unregistered / Unconfirmed
GUEST, unregistred user!
我用mediaplayer放CD,告诉我MMSYSTEM296,无法在指定MCI设备
上播放该文件,请问如何搞定。
 
那是你的windows没装好!或者注册表损坏!
前者只要把声卡删除重装,后者只有重装95
还有,MCI是不是被占用!
 
不是这个原因吧,我可以放CD的。但是我编的程序
没法放。而且,前后我一共写了7,8遍,程序一模一样
只有一次成功,有一半是用D3写的,一半是用D4写的
成功的那次是D3。
 
试了一下
好像必须加上一句
FileName := f:/***.cda
^^^
光驱中任意一个cda文件就可以了
 
mayday兄,我也试过给出FILENAME,但用了名字就报错。
我想可能是D3,D4的问题。我再试一遍。
 
用 CDAudio 可可以?
 
我已试过,是D3行,D4不行。谢谢大家。
 
我已试过,是D3行,D4不行。谢谢大家。
 
walala:
是Delphi4的Tmediaplayer有问题,我以前在大富翁里提到过并且
提到如何修正错误,如需要的话我可妹个给你
 
rockboy thanks 给俺妹子发一个吧 bbstone@263.net
 
修改Mplayer.pas文件的TMediaPlayer.Open函数,参见下面代码的注释部分,
修改完毕后将Mplayer.pas复制到lib目录下重新编译程序(build all)即可

procedure TMediaPlayer.Open;
const
DeviceName: array[TMPDeviceTypes] of PChar = ('', 'AVIVideo', 'CDAudio', 'DAT',
'DigitalVideo', 'MMMovie', 'Other', 'Overlay', 'Scanner', 'Sequencer',
'VCR', 'Videodisc', 'WaveAudio');
var
OpenParm: TMCI_Open_Parms;
DisplayR: TRect;
begin

if MCIOpened then
Close;
{must close MCI Device first before opening another}

// FillChar(OpenParm, SizeOf(TMCI_Open_Parms), #0);
file://added by rockboy 98.12

OpenParm.dwCallback := 0;
if FDeviceType <> dtAutoSelect then
{fill in Device Type}
OpenParm.lpstrDeviceType := DeviceName[FDeviceType];
OpenParm.lpstrElementName := PChar(FElementName);

FFlags := 0;
if FUseWait then

begin

if FWait then
FFlags := mci_Wait;
FUseWait := False;
end
else
FFlags := mci_Wait;
if FUseNotify then

begin

if FNotify then
FFlags := FFlags or mci_Notify;
FUseNotify := False;
end;

// FFlags := FFlags or mci_Open_Element;
file://org code;
// modified by rockboy
if FElementName <> '' then

FFlags := FFlags or mci_Open_Element;

if FDeviceType <> dtAutoSelect then
FFlags := FFlags or mci_Open_Type;
if FShareable then
FFlags := FFlags or mci_Open_Shareable;
OpenParm.dwCallback := Handle;
FError := mciSendCommand(0, mci_Open, FFlags, Longint(@OpenParm));

if FError <> 0 then
{problem opening device}
raise EMCIDeviceError.Create(ErrorMessage)
else
{device successfully opened}
begin

MCIOpened := True;
FDeviceID := OpenParm.wDeviceID;
FFrames := Length div 10;
{default frames to step = 10% of total frames}
GetDeviceCaps;
{must first get device capabilities}
if FHasVideo then
{used for video output positioning}
begin

Display := FDisplay;
{if one was set in design mode}
DisplayR := GetDisplayRect;
FDWidth := DisplayR.Right-DisplayR.Left;
FDHeight := DisplayR.Bottom-DisplayR.Top;
end;

if (FDeviceType = dtCDAudio) or (FDeviceType = dtVideodisc) then

TimeFormat := tfTMSF;
{set timeformat to use tracks}

FAutoButtons := [btNext,btPrev];
{assumed all devices can seek to start, end}
if FCanStep then
FAutoButtons := FAutoButtons + [btStep,btBack];
if FCanPlay then
Include(FAutoButtons, btPlay);
if FCanRecord then
Include(FAutoButtons, btRecord);
if FCanEject then
Include(FAutoButtons, btEject);
if Mode = mpPlaying then
AutoButtonSet(btPlay);
{e.g. CD device}
DrawAutoButtons;
end;


end;

 

Similar threads

顶部