修改 Application 后,BPL 里每个组件都得手动 parent := nil,怎办?

EDDGA 2019-07-22 04:07:59
环境是 Delphi 7 + XP,问题的一些相关的情况如下:
1、需要在程序启动之前做一些前置操作,我修改了Application(Controls.pas),于是工程不能 build with vcl。
2、新建了BPL,包含有一些自定义的TNewFrame,继承自TFrame,通过类似如下的 function 加入到程序界面

function build(c : TWinControl) : TNewFrame;
//……
begin
f := TNewFrame.Create(c);
f.Parent := c; // ->这一句导致 AV
result := f;
end;

export build;


问题是:程序关闭会AV。测试过有2种做法不会AV
1、程序在关闭前 f.Parent := nil,不会 AV;这样的话每个自定义的组件都得 parent := nil,
2、build with vcl,不会AV。可是这样就不能修改 Application 了

请问有什么方法,既可能修改 Application,又不用 parent := nil

PS: 我的 Delphi 7 的 vcl 只有 dcp,没有 dpk,没法 build。
...全文
36 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
Delphi 7.1 Update Release Notes=======================================================This file contains important supplemental and late-breakinginformation that may not appear in the main productdocumentation, and supersedes information contained in otherdocuments, including previously installed release notes.Borland recommends that you read this file in its entirety.NOTE: If you are updating a localized version of Delphi 7, visit the Borland Registered User web site to obtain a localized readme file that may contain important late- breaking information not included in this readme file.IMPORTANT: Delphi must be closed before installing this update. =====================================================CONTENTS * INSTALLING THIS UPDATE * UPDATING LOCALIZED VERSIONS OF DELPHI 7 * KNOWN ISSUES * ISSUES ADDRESSED BY THIS UPDATE - IDE - CORE DATABASE - DATASNAP - DBGO (ADO COMPONENTS) - dbExpress - dbExpress COMPONENTS AND DB VCL - dbExpress CORE DRIVER AND METADATA - dbExpress VENDOR ISSUES - dbExpress CERTIFICATION - WEB SNAP - ACTIVEX - COMPILER - RTL - VCL - THIRD PARTY - BOLD FOR DELPHI * VERIFYING THAT THE UPDATE WAS SUCCESSFUL * FILES INSTALLED BY THIS UPDATE =======================================================INSTALLING THIS UPDATE* This update can not be applied to Delphi 7 Architect Trial version. * This update can not be removed after it is installed.* You will need the original Delphi 7 installation CD available to install this update.* To install this update from the CD, insert the CD, and launch the d7_ent_upd1.exe file appropriate for your locale.* To install this update from the Web, double-click the self-executing installation file and follow the prompts. * The Delphi 7 documentation PDF files are available on the update CD.========================================================UPDATING LOCALIZED VERSIONS OF DELPHI 7* This update can be applied only to the English version of Delphi 7. There are separate updates for the German, French and Japanese ver

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧