不知道什么叫打开?是不是创建了就算打开了?如果是这样的话可以这样判断:for i := 0 to Application.ComponentCount - 1 do begin if Application.Components[i] is TForm then ......... end;
1.if Form1.Active then ...2.给你代码参考var Hdl,hd: THandle; DC: HDC; begin FORM2.SHOW; form2.update; Hdl := Application.Handle; hd := GetWindow(Hdl, GW_HWNDLAST + GW_CHILD); if hd <> NULL then begin DC := GetDC(hd); Ellipse(DC, 0, 0, 100, 100); ReleaseDC(hd, DC); end; end;
你用全局变量吗? 那样的话 if not assgined(FormName) then begin create end else show
FormName.Show;
begin
if Application.Components[i] is TForm then
.........
end;
Hdl,hd: THandle;
DC: HDC;
begin
FORM2.SHOW;
form2.update;
Hdl := Application.Handle;
hd := GetWindow(Hdl, GW_HWNDLAST + GW_CHILD);
if hd <> NULL then
begin
DC := GetDC(hd);
Ellipse(DC, 0, 0, 100, 100);
ReleaseDC(hd, DC);
end;
end;
那样的话
if not assgined(FormName) then
begin
create
end
else
show
用一个List,来保存form object
之后在list中判断
begin
//创建窗口
end//对窗口进行操作
(提醒用GetClass())
(提醒用GetClass())