OCX的资源释放问题 做的几个OCX控件,在网页同一页面里调用,第一个链接打开后总是正确的,后面的就会出现Access violate ……之类的错误,怀疑是没有释放内存问题,但是自己在程序中只是用了一些简单的控件(如Timage\Tedit\Tlabel等)、(动态)数组等,这些要释放吗?如果要释放,用free还是dispose?是在destroy事件中写释放吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我再destroy事件中对动态数组执行:=nil,但是在ie关闭时destroy事件并不执行?我的初始化的代码是procedure TActiveFormX.Initialize;var i:integer;const mystring='edit';begin inherited Initialize; OnActivate := ActivateEvent; OnClick := ClickEvent; OnCreate := CreateEvent; OnDblClick := DblClickEvent; OnDeactivate := DeactivateEvent; OnDestroy := DestroyEvent; OnKeyPress := KeyPressEvent; OnPaint := PaintEvent; edit24.Color:=clyellow; edit24.Left:=shape1.Left+1; edit24.Width:=shape1.Width-2; edit24.Height:=20; edit25.Color:=clyellow; edit25.Left:=shape2.Left+1; edit25.Width:=shape2.Width-2; edit25.Height:=20; for i:=4 to 13 do begin tedit(findcomponent(mystring+inttostr(i))).Color:=clskyblue; tedit(findcomponent(mystring+inttostr(i))).Left:=shape1.Left+1; tedit(findcomponent(mystring+inttostr(i))).Top:=shape1.top+20*(i-4); tedit(findcomponent(mystring+inttostr(i))).Width:=shape1.Width-2; tedit(findcomponent(mystring+inttostr(i))).Height:=20; tedit(findcomponent(mystring+inttostr(i))).Visible:=false; tedit(findcomponent(mystring+inttostr(i))).Text:=''; end; for i:=14 to 23 do begin tedit(findcomponent(mystring+inttostr(i))).Color:=clskyblue; tedit(findcomponent(mystring+inttostr(i))).Left:=shape2.Left+1; tedit(findcomponent(mystring+inttostr(i))).Top:=shape1.top+20*(i-14); tedit(findcomponent(mystring+inttostr(i))).Width:=shape2.Width-2; tedit(findcomponent(mystring+inttostr(i))).Height:=20; tedit(findcomponent(mystring+inttostr(i))).Visible:=false; tedit(findcomponent(mystring+inttostr(i))).Text:=''; end; edit24.Top:=edit13.Top; edit25.Top:=edit23.Top; label4.Height:=25; label4.Width:=185; label5.Height:=25; label5.Width:=185; trackbar1.Position:=2; label6.Top:=0; label6.Left:=0; label6.Width:=920; label6.Height:= 75; listbox1.ScrollWidth:=800; listbox2.ScrollWidth:=800; end;请问有什么资源要释放吗? label.caption或edit.text不能用adoquery赋值 寻数据同步解决方案 关于delphi扩展名图标问题 怎么能让d6的dbExpress连接上MySQL5.0.4 100查找ms sql server driver for dbexpress的安装程序 声明变量时出错 我想程序运行之前,显示一个登录窗口,可是出错,怎么回事呢? 如何实现,程序一启动,plane自动停靠在Form上,并出现拖动的竖条 100分!! 关于恢复数据库的问题! 斑竹,何故我的贴子不翼而飞??? 如何获得特定软件的安装目录 加载ocx
procedure TActiveFormX.Initialize;
var
i:integer;
const
mystring='edit';
begin
inherited Initialize;
OnActivate := ActivateEvent;
OnClick := ClickEvent;
OnCreate := CreateEvent;
OnDblClick := DblClickEvent;
OnDeactivate := DeactivateEvent;
OnDestroy := DestroyEvent;
OnKeyPress := KeyPressEvent;
OnPaint := PaintEvent;
edit24.Color:=clyellow;
edit24.Left:=shape1.Left+1; edit24.Width:=shape1.Width-2;
edit24.Height:=20; edit25.Color:=clyellow;
edit25.Left:=shape2.Left+1;
edit25.Width:=shape2.Width-2;
edit25.Height:=20; for i:=4 to 13 do
begin
tedit(findcomponent(mystring+inttostr(i))).Color:=clskyblue;
tedit(findcomponent(mystring+inttostr(i))).Left:=shape1.Left+1;
tedit(findcomponent(mystring+inttostr(i))).Top:=shape1.top+20*(i-4);
tedit(findcomponent(mystring+inttostr(i))).Width:=shape1.Width-2;
tedit(findcomponent(mystring+inttostr(i))).Height:=20;
tedit(findcomponent(mystring+inttostr(i))).Visible:=false;
tedit(findcomponent(mystring+inttostr(i))).Text:='';
end;
for i:=14 to 23 do
begin
tedit(findcomponent(mystring+inttostr(i))).Color:=clskyblue;
tedit(findcomponent(mystring+inttostr(i))).Left:=shape2.Left+1;
tedit(findcomponent(mystring+inttostr(i))).Top:=shape1.top+20*(i-14);
tedit(findcomponent(mystring+inttostr(i))).Width:=shape2.Width-2;
tedit(findcomponent(mystring+inttostr(i))).Height:=20;
tedit(findcomponent(mystring+inttostr(i))).Visible:=false;
tedit(findcomponent(mystring+inttostr(i))).Text:='';
end;
edit24.Top:=edit13.Top;
edit25.Top:=edit23.Top;
label4.Height:=25;
label4.Width:=185;
label5.Height:=25;
label5.Width:=185;
trackbar1.Position:=2;
label6.Top:=0;
label6.Left:=0;
label6.Width:=920;
label6.Height:= 75; listbox1.ScrollWidth:=800;
listbox2.ScrollWidth:=800; end;
请问有什么资源要释放吗?