Delphi7的问题,在用Delphi的DFW帮帮忙啦。(100分)

  • 主题发起人 philipliu
  • 开始时间
P

philipliu

Unregistered / Unconfirmed
GUEST, unregistred user!
用ActionList新建一个Action,Action的ShortCut为‘Ins’(随便什么都行),
在Action的OnExecute事件中:
procedure TForm1.Action1Execute(Sender: TObject);
begin
Abort;
end;
不管Abort前后有什么代码,或者Abort出现在Action1Execute的调用过程中,
只要用ShortCut方式执行(按下‘Ins’)就会出下面错误:
Access violation at address 0040B6F0 in module 'Project1.exe'. Read of address 00000031.
但是不用ShortCut方式执行就没问题,请DFW帮帮下忙,救命啦。
 
确实如此,提前
 
新东西总有不完美的地方
 
ActionList这个东西好象是将菜单固定为某个模式的,我用了一下,搞不掂他,
后来就没有用了。
 
试试这段看,好象没出现:
procedure TForm1.Action1Execute(Sender: TObject);
begin
if DBEdit1.Text = '' then
Abort;
end;
 
弄清楚,是按快捷键才会出这个错。
 
是啊,我设的是 F7 啊。你自己测试看看,我加了调试点可以很清楚看到流向:
procedure TForm1.Action1Execute(Sender: TObject);
begin
MessageBox(Handle,'OK ! over here A.','Test',mb_Ok);
if DBEdit1.Text = '' then
Abort; // 如果 DBEdit1.Text = '' 到这句就返回,不执行下一句
MessageBox(Handle,PChar('OK ! over here B.'+DBEdit1.Text),'Test',mb_Ok);
end;

如果这样,肯定死机:
procedure TForm1.Action1Execute(Sender: TObject);
begin
MessageBox(Handle,'OK ! over here A.','Test',mb_Ok);
Abort; // 这句死机!!!(请到 Windows 2000 下执行,以免无法恢复)
MessageBox(Handle,'OK ! over here B.','Test',mb_Ok);
end;
 
怎么不说了?明白了?还没解除疑虑,给我来信。
 
小雨哥:
明白你的意思,但是如果没有条件判断呢?
 
顶部