用mcisendstring函数播放MP3的情况下,怎样用Progressbar显示其播放进度?请高手指教。
procedure TForm1.Button1Click(Sender: TObject);
var//播放MP3
res:TResourcestream;//MP3流
filename:string;//用作临时文件
begin
...//播放MP3,以下是进度条语句
res:=nil;
progressbar1.Min:=0;
progressbar1.Max:=res.Size ;
progressbar1.StepIt ;
if progressbar1.Position <res.Size then
progressbar1.Position :=progressbar1.Position+1
else
progressbar1.Position :=0;
if(progressbar1.Position =progressbar1.Max)then
close;
end;
点击RUN能顺利出现窗体,但点击button1时却出现异常通知对话框:
debugger exception notification
project P999.exe raised exception class EAccessViolation with message Access violation at adress 00452753 in module 'P999.EXE'. Read of address 00000000'.
precess stopped.use step or run to continue.
程序反复播放刚出现的短暂的MP3开头音乐,箭头指向progressbar1.Max:=res.Size ;这一句。
请问高手怎样改正完善代码?!有另外的写法吗?
=======================================
问zwh202342:sizeof怎么使用?