超级郁闷的事情:单步执行到某步的时候,再按F9运行没问题!但是如果不设置断点,运行的时候会出现错误!
下面是错误提示:
---------------------------
Debugger Exception Notification
---------------------------
Project MingS.exe raised exception class EAccessViolation with message 'Access violation at address 03516828. Write of address 00000000'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
唉,有的时候重启再执行又没问题,唉!烦啊!
下面是错误提示:
---------------------------
Debugger Exception Notification
---------------------------
Project MingS.exe raised exception class EAccessViolation with message 'Access violation at address 03516828. Write of address 00000000'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
唉,有的时候重启再执行又没问题,唉!烦啊!
Debugger Exception Notification
---------------------------
Project MingS.exe raised exception class EStackOverflow with message 'Stack overflow'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------有时候是提示这个错误!堆栈溢出!
if length(mystates)<>FCountP then
setlength(mystates,FCountP);
showmessage(inttostr(high(mystates)));
for i:=0 to high(mystates) do
updatestate(page*fcountP+i);
end;
错误是在这段,发现i到了50左右的时候,提示出错,就是说0000000位置的地方读写错误,但是第一次执行的过程中是没有这个问题的。
---------------------------
Debugger Exception Notification
---------------------------
Project MingS.exe raised exception class EStackOverflow with message 'Stack overflow'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
Application.Initialize; Form3:=Tform3.Create(Form3);
Frmlogin:=Tfrmlogin.Create(Frmlogin);
Frmlogin.ShowModal;
if not isloginin then Application.Terminate; Application.CreateForm(TFrmMain, FrmMain);
Application.CreateForm(TFrmQuery, FrmQuery);
Application.CreateForm(TFrmWait, FrmWait);
//Application.CreateForm(TForm1, Form1);
Application.Run;其中在Frmlogin里动态创建了ini文件
cfgini:=Tinifile.Create(path+'config.ini');
不过我在关闭窗体的时候已经释放了:
procedure TFrmLogin.FormClose(Sender: TObject; var Action: TCloseAction);
begin
cfgini.free;
end;
//制作每页Item的过程,但是具体的items由各自的子类去实现
var
itemCount,i,j:integer;//i:数据集的循环标志,j:雇员循环标记,k当前搜索到的,号的位置
strEM:string;
begin
//1:计算page的Item数量(判断当前是否是最后一页,是的话,则要计算了)
//page的开始也是从0开始的
p_item.Visible:=false; RG_Page.Enabled:=false;
if page<0 then exit; if page=FpageCount-1 then//最后一页
begin
if FPageCount>1 then
itemcount:=mydata.RecordCount-page*FCountP
else
itemcount:=mydata.RecordCount;
end
else
itemcount:=FCountP; if length(mystates)<itemcount then
setlength(mystates,itemcount); //停止item的倒计时控件作用
if assigned(mystates[0]) then
mystates[0].StopForUpdate; for i:=0 to high(mystates) do
begin
if i<itemcount then
updatestate(page*FcountP+i)
else
freeandnil(mystates[i]);
end;
//重新开启item的倒计时控件作用
if assigned(mystates[0]) then
mystates[0].BeginAfterUpdate;
if length(mystates)>itemcount then
setlength(mystates,itemcount);
if (mystates[0].Top=mystates[itemcount-1].Top) and (mystates[0].left=mystates[itemcount-1].left) then
pailieall; Sleep(900);
p_item.Visible:=true;
RG_Page.Enabled:=true;
FShowCount:=itemcount;
-------------------------------------------
Frmlogin:=Tfrmlogin.Create(Frmlogin);
Frmlogin.ShowModal;
freeandnil(Frmlogin);//释放你刚才showmodal出来的窗体(这步是在Frmlogin关闭之后才执行的!)
Application.Initialize;
Frm_Loading:=TFrm_Loading.Create(application);
Frm_Loading.Show;
Frm_Loading.Update;
Application.CreateForm(TDM, DM);
Application.CreateForm(TMainForm, MainForm);
Frm_Loading.Destroy;
Login:=TLogin.Create(nil);
login.ShowModal;
login.Free;
login:=nil;
Application.Run;