if  assigned(form1) then   //是否为窗体分配内存了
begin
   form1:=tform1.create(self);  //建立窗体
   form1.showmodal;
 end ;
end;
是否ok  ?

解决方案 »

  1.   

    function Tqueryform.existsform(Formclass:TFormClass):boolean;
    //formclass 为窗体类
    var
      i:integer;
    begin
      result:=false;
      for i := 0 to Screen.FormCount - 1 do
      if Screen.Forms[i].ClassType=FormClass then
      begin
        result:=true;
        break;
      end;
    end;
      

  2.   

    要用MsgWaitForMultipleObjects来确定窗口是否可以接受消息
      

  3.   

    标准答案:
    if findComponent('Form1')<>nil then ShowMessage('窗口已创建!');
      

  4.   

    如果你的窗体名称已经知道了,那么采用
        if FormName<>nil then
        begin
          ...
        end
        else 
        begin
          ...
        end;
    就可以判断该窗体是否已经创建了。
      

  5.   

    不必给分
    if FindComponent(窗体名)<>nil then 窗体已创建 ;
      

  6.   

    Findwindows(AppClassname,WindowTitle);
    API