用什么方法判断MDI程序中的MDIChild窗体已经创建,并不让它重复创建?
解决方案 »
- webbrowser多线程
- 谁有delphi2005的注册文件,请给发一个! my email: [email protected]
- 一个安装文件制作的问题请教
- delphi5怎样连接unix下得informix啊?高手请指点!
- 有哪位是计算机毕业的,但又在银行工作的,请进
- interbase安装完有部分怎么不能用呀
- 怎样才能走上Delphi高手之路?
- 想做一個Delphi源碼編輯器,Delphi DFM文件文字保存的格式是#2464#2646,問自己設計程序該如何將#2464#2646讀出成漢字,保存又按#2464#26
- 窗体放大后,各控件如何相应放大???
- 各位大侠,十三妹这有一个解决不了的问题,请赐教,不甚感激!!!(修改)
- 如何在线程中使用IdHttp,完全解决者200赠送!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 谁用过TRichView控件?
if not assigned(form2) then
form2:=tform2.create(application);
var
i: integer;
Child:TForm;
begin
for i := 0 to Screen.FormCount -1 do
if Screen.Forms[i].ClassType=FormClass then
begin
Child:=Screen.Forms[i];
if Child.WindowState=wsMinimized then
ShowWindow(Child.handle,SW_SHOWNORMAL)
else
ShowWindow(Child.handle,SW_SHOWNA);
if (not Child.Visible) then Child.Visible:=True;
Child.BringToFront;
Child.Setfocus;
TForm(fm):=Child;
exit;
end;
Child:=TForm(FormClass.NewInstance);
TForm(fm):=Child;
Child.Create(AOwner);
end;
Form1: TForm1;implementation
uses unit2;
{$R *.dfm}procedure TForm1.BitBtn1Click(Sender: TObject);
begin
if not assigned(form2) then
form2:=tform2.create(application);
form2.Show;
end;这样不可以么,你想达到什么目的??
就是判断当前是否已经创建了form2这个mdichild型的子窗体,如果没有则创建!
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.
上面一句对这个函数说得已经很清楚了,如果参数p空则函数返回值为false,反之为true
var incaseFrm : TincaseFrm;
begin
if Not Assigned(incaseFrm) then
incaseFrm := TincaseFrm.Create(Application);
incaseFrm.Show;
end;不过先谢了。