为什么会出现exception eaccessviolation错误?
我有一段这样的程序:
procedure TForm1.DriveComboBox1Change(Sender: TObject);
var
flag:boolean;
drive:string;
fav1,tsp1:int64;
tfr1:plargeinteger;
fsp1,allsp1:string;
fsp2,allsp2:string;
begin
drive:=drivecombobox1.drive+':\';
flag:=getdiskfreespaceex(pchar(drive),fav1,tsp1,tfr1);
if flag then
begin
allsp1:=(formatfloat('###,##0',tsp1));
fsp1:=formatfloat('###,##0',fav1);
showmessage('所选磁盘总共容量为:'+allsp1+'字节');
allsp2:='所选磁盘总共容量为:'+allsp1+'字节';
edit1.Text:=fsp2;
label4.caption:=('所选磁盘总共容量为:'+allsp1+'字节');
label3.caption:='可用容量为:'+' MB ('+fsp1+'字节)';
showmessage('可用容量为:'+inttostr(fav1 div (1000000))+' MB ('+fsp1+'字节)');
end;
end;
然后在运行到edit1.text:=fsp2;这一行时开始出错(加上下面两行,label.caption:=),错误信息为:
exception eaccessviolation in module getdrvp.exe at 00049ee2.
access violation at address 00449ee2 in module 'getdrvp.exe'.read of address ffffffff.
为什么会出现这种错误呢?