Delphi DLL动态调用的子窗体怎么判断子窗体是否存在

zhuohongsheng 2015-08-19 04:43:31
Delphi 主窗体动态调用DLL的一个子窗体。 怎么判断DLL子窗体是否已存在(在主窗体中已打开),
如果打开则只需要置前
动态调用代码如下:
// DllFormName 为 DLL中的一个子窗体
// ParentForm 为 主窗体
Application := App;
TheClass := GetClass(DllFormName);
if (TheClass = nil) then exit;
if TheClass.InheritsFrom(TForm) then
begin
try
begin
aForm := TForm(TheClass.Create).Create(ParentForm);
aForm.FormStyle := fsMDIChild;
aForm.Show;
aForm.BringToFront;
finally
FreeLibrary(ParentForm.Handle);
end;
end;
...全文
173 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
踏雪无痕 2015-08-26
  • 打赏
  • 举报
回复
做一个公共变量,存在的赋值,然后可以判断出来了。。。。。。。。。
lyhoo163 2015-08-25
  • 打赏
  • 举报
回复
if not Assigned(MID_1_Frm) then
begin
MID_1_Frm:=TMID_1_Frm.Create(Self);
MID_1_Frm.WindowState:=MID_WindowState;
end
else MID_1_Frm.BringToFront;
lanyun2 2015-08-25
  • 打赏
  • 举报
回复
你不是用aForm保存这个窗体了吗 再判断的话,继续判断aform就行了啊

5,388

社区成员

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

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