大哥们:
  问两个问题:
  1:怎样判断一个窗体打开了,如果打开了就把它关闭。
  2:怎样做一个类似于showmessage函数调用的对话框,不过按钮可以自己加,并写代码?

解决方案 »

  1.   

    1.if Form1<> nil then
    begin
      form1.free;
      From1 = nil;
    end;
    2.write a class to do this.
      

  2.   

    if not assigned(frmplshow) then
      begin
        frmplshow := Tfrmplshow.create(nil);
        frmplshow.show;
      end
      else
        frmplshow.close;
      

  3.   

    1:
    procedure Tmain.N27Click(Sender: TObject);
    begin
      if assigned(form1) then
      form1.close;
    end;
    2:没听明白
      

  4.   

    1:
    procedure TForm1.FormCreate(Sender: TObject);
    var
        a:Hwnd;
    begin
        a:=findwindow(nil,pChar('窗体名'));
        sendmessage(a,Wm_Close,0,0);
    end;
      

  5.   

    2:用Application.MessageBox就实现了
      

  6.   

    我是用new 里面的标准dialog做的
    但是我想作成对话框总在前面,如果不关闭他,其它窗体不能获得焦点
    该设置哪个属性?
      

  7.   

    使用showModal可以,因为那个里面的对话框和form一样使用。
      

  8.   

    1.用寻找窗体FINDWINDOWS来判断..
    2.用正常的FORM来做就行..
      

  9.   

    if form2.showing then form2.close;