如何使我单击主窗体的关闭按钮(就是那个叉)时,程序缩小放在任务必栏上.flashget就是那样的.

解决方案 »

  1.   

    去WWW.PLAYICQ.COM下载一个CoolTrayIcon控件吧!轻松搞定!
      

  2.   

    我DOWN下来啦!但想实现上面的功能,我设了好一会儿,都不行呀!有没有实现上面功能的代码,或用CoolTrayIcon如何设能够实现呀?
      

  3.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs,shellapi;
    const
    wm_trayicon=wm_app+0;
    type
      TForm1 = class(TForm)
      private
        { Private declarations }
        Procedure WMSysCommand(Var msg : TMessage);Message WM_SYSCOMMAND;
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    procedure modifytrayicon(action:dword);
    var
      nidata:tnotifyicondata;
    begin
      with nidata do begin
       cbsize:=sizeof(tnotifyicondata);
       uid:=0;
       uflags:=NIF_MESSAGE or NIF_ICON or NIF_TIP;
       wnd:=Form1.handle;
       ucallbackmessage:=wm_trayicon;
       hicon:=application.Icon.Handle ;
       strpcopy(sztip,application.Title );
      end;
      shell_notifyicon(action,@nidata);
    end;procedure TForm1.WMSysCommand(var msg: TMessage);
    begin
      case Msg.WParam of
        SC_CLOSE    :begin
                       msg.WParam :=0;
                     //  showwindow(Form1.Handle,sw_hide);
                       form1.Hide;
                        modifytrayicon(nim_add);
                     end;
      end;
      Inherited;
    end;end.
      

  4.   

    lion_lh(xmanx)兄的代码被充了LOF兄控件的不足之外,但是我用 lion_lh(xmanx)代码时,现在多出了一个托盘,运行时有两个托盘呀! lion_lh(xmanx)代码中如何把那个托盘去掉呀,不要显示!
    Thanks!
      

  5.   

    呵呵,这样
    不让程序关闭,而缩小到托盘!
    procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
    canclose:=false;
    CoolTrayIcon1.HideMainForm;
    end;
    CoolTrayIcon1 这个东西很好,可以做动态的托盘图标,以及流动的文字图标。
    功能相当的全,你自己看看例子,很酷的!
      

  6.   

    窗体销毁的时候  modifytrayicon(nim_delete);
      

  7.   

    解决了!但是反应的速度我试着点了一下,没有flashget的快哟!不知怎么回事!