我在Dll中用 
  showwindow(handle,sw_show);
语句显示一个From,发现在from里用hide命令无法隐藏窗口了;
要怎么做才能隐藏?

解决方案 »

  1.   

    在dll里面执行hide命令试试呢?然后再调用dll!
      

  2.   

    program Project1;uses
      Forms,
      Unit1 in 'Unit1.pas' {Form1},
      Unit2 in 'Unit2.pas' {Form2};{$R *.res}begin
      Application.Initialize;
      Application.CreateForm(TForm1, Form1);
      Application.CreateForm(TForm2, Form2);
      Application.Run;
    end.unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        Button2: TButton;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation
    uses
      unit2;
    {$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
      Form2.Show;
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
        showwindow(Form2.Handle,sw_show);
    end;end.unit Unit2;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm2 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form2: TForm2;implementation{$R *.dfm}procedure TForm2.Button1Click(Sender: TObject);
    begin
      hide;
    end;end.程序清单如上,在Form1中按button1显示Form2,一切正常,按Button2显示Form1,则不能隐藏.到底 ShowWindow 该如何用?
      

  3.   

    用VB试了一下,2条语句一样的,都能hide
    难道是Delphi的BUG?
    不是微软的东西就是麻烦啊.
      

  4.   

    >>>回复人: YoYoloveMRDJ(葱) ( ) 信誉:100  2003-12-26 08:37:00  得分:0 
    >>>  visible:=false;
      
     
    也不行!!!!!!!!!!!!!!!!!!!!!!!!!!!!!没反应
      

  5.   

    procedure TForm1.Button2Click(Sender: TObject);
    begin
        showwindow(Form2.Handle,sw_hide);
    end;end.
      

  6.   

    如果要隐藏form1(主窗口)那就需要这样
    application.showmainform:=false;
    form1.hide;
    //显示form1
    application.showmainform:=true;
    form1.show;
      

  7.   


    procedure TForm2.Button1Click(Sender: TObject);
    begin
      hide;
    end;中的
     hide改为
     ShowWindow(Handle, SW_HIDE);
      

  8.   

    DragonBill(月满西星) 
    呵呵,那不是有效的解决办法,如果那样的话,form.show就不起作用了.