天大的搞笑问题 ( 积分: 50 )

  • 主题发起人 主题发起人 foreachman
  • 开始时间 开始时间
F

foreachman

Unregistered / Unconfirmed
GUEST, unregistred user!
我的一个程序中一个主界面同时播放flash,VCD呀别的文件,如果是播放VCD的文件就报错,
Violation at address 00000000.Read of address 00000000
报的这个错跟踪不到,它不是代码出错,是在另一播放显示时出错,出错的地放在application.run(...)后出错
代码如下:
procedure showpalyform ;
begin
try
play_num:= play_num+1;
if FrmIonElecMain.RzPanel11.ControlCount>0 then
begin
Tform(FrmIonElecMain.RzPanel11.Controls[0] as TForm).Close;
end;
if FrmIonElecMain.RzPanel4.ControlCount>0 then
begin
Tform(FrmIonElecMain.RzPanel4.Controls[0] as TForm).Close;
end;
if FrmIonElecMain.RzPanel12.ControlCount>0 then
begin
Tform(FrmIonElecMain.RzPanel12.Controls[0] as TForm).Close;
end;
//************** flash or meida play ****************//
if play_num> play_ext.Count-1 then
play_num := 0;
Sleep(200);
if (play_ext[play_num]='avi') or (play_ext[play_num]='asf') or
(play_ext[play_num]='wf') or (play_ext[play_num]='wmv')or (play_ext[play_num]='rm') then
ShowModalFrom(TFrmmedia,Frmmedia,Frmmedia,FrmIonElecMain.RzPanel4)
else
ShowModalFrom(TFrmflash,Frmflash,Frmflash,FrmIonElecMain.RzPanel4);
//************** flash2 or meida2 play ****************//
if play_ext.Count>1 then
begin
if play_num > play_ext.Count-2 then
begin
if play_num = play_ext.Count-1 then multiplaynum2:= 0
else multiplaynum2:= 1
end else multiplaynum2 := play_num+1;
end
else multiplaynum2:=0 ;
if (play_ext[multiplaynum2]='avi') or (play_ext[multiplaynum2]='asf') or
(play_ext[multiplaynum2]='wf') or (play_ext[multiplaynum2]='wmv')or (play_ext[multiplaynum2]='rm') then
ShowModalFrom(TFrmmedia2,Frmmedia2,Frmmedia2,FrmIonElecMain.RzPanel11)
else
ShowModalFrom(TFrmflash2,Frmflash2,Frmflash2,FrmIonElecMain.RzPanel11);
//************** flash3 or meida3 play ****************//
if play_ext.Count>2 then
begin
if play_num=play_ext.Count-3 then
multiplaynum3 := play_ext.Count-1 ;
if play_num=play_ext.Count-2 then
multiplaynum3 := 0 ;
if play_num=play_ext.Count-1 then
multiplaynum3:=1 ;
if play_num< play_ext.Count-3 then
multiplaynum3 := play_num+1;
end
else multiplaynum3:=0 ;
if (play_ext[multiplaynum3]='avi') or (play_ext[multiplaynum3]='asf') or
(play_ext[multiplaynum3]='wf') or (play_ext[multiplaynum3]='wmv')or (play_ext[multiplaynum3]='rm') then
ShowModalFrom(TFrmmedia3,Frmmedia3,Frmmedia3,FrmIonElecMain.RzPanel12)
else
ShowModalFrom(TFrmflash3,Frmflash3,Frmflash3,FrmIonElecMain.RzPanel12);
Except on ee :exception do
begin
ShowMessage(ee.Message);
Application.Terminate;
end;
end;
end;
procedure ShowModalFrom(InstanceClass: TComponentClass; var Reference;
Instance: TComponent; panel :TRzPanel );
begin
if (Instance<> nil) and (Instance is TForm) then
(Instance as TForm).BringToFront else
begin
Instance := TComponent(InstanceClass.NewInstance);
TComponent(Reference) := Instance;
Instance.Create(nil);
try
(TForm(Instance)).Align :=alClient;
(TForm(Instance)).BorderStyle := bsNone;
(TForm(Instance)).Parent := panel;
(TForm(Instance)).Show;
except
Instance.Free;
TComponent(Reference) := nil;
Application.Terminate;
end;
end;
end;
 
后退
顶部