怎样判断窗体是否已经创建

ss__328 2002-08-29 07:47:42
如题
...全文
141 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
dupenf 2002-08-30
  • 打赏
  • 举报
回复
assign too
jeking 2002-08-29
  • 打赏
  • 举报
回复
用assinged(form1) 判断
zhxfzhxf1 2002-08-29
  • 打赏
  • 举报
回复
if Form1=nil then
。。。
else
。。。
del_c_sharp 2002-08-29
  • 打赏
  • 举报
回复
呵呵,楼上是不是写反了
nil了以后,还free谁呢?
fwwxxjingling 2002-08-29
  • 打赏
  • 举报
回复
我一般是这样做的:
*************************************************************
if form1<>nil then
begin
form1=nil;
form1.free;
end;
form1:=Tform1.Create;
*************************************************************
fwwxxjingling 2002-08-29
  • 打赏
  • 举报
回复
the use of assigned:
****************************************************************
Tests for a nil (unassigned) pointer or procedural variable.

Unit

System

Category

miscellaneous routines

function Assigned(const P): Boolean;

Description

Use Assigned to determine whether the pointer or procedure referenced by P is nil. P must be a variable reference of a pointer or procedural type. Assigned(P) corresponds to the test P<> nil for a pointer variable, and @P <> nil for a procedural variable.

Assigned returns False if P is nil, True otherwise.

Note: Assigned can't detect a dangling pointer--that is, one that isn't nil but no longer points to valid data. For example, in the code example for Assigned, Assigned won't detect the fact that P isn't valid.
********************************************************************
ihihonline 2002-08-29
  • 打赏
  • 举报
回复
if assinged(form1)
form1 := Tform1.Create(nil)
cbdiy 2002-08-29
  • 打赏
  • 举报
回复
var kk:hwnd;
begin
kk:=findwindow(nil,'Form2');
if kk<>0 THEN showmessage('已存在');
rtewryery 2002-08-29
  • 打赏
  • 举报
回复
if assinged(form1) then
begin
showmessage("窗体已经建立");
end;
blazingfire 2002-08-29
  • 打赏
  • 举报
回复
if Form1=nil then
//没有创建
rtewryery 2002-08-29
  • 打赏
  • 举报
回复
if assign(form1)<>nil then
begin
dosomething;
end;

5,386

社区成员

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

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