你用一个 系统托盘控件.TrayIcon1
在lmd控件包里有。 www.51delphi.com里有下载.Application.Minimize;  //最小化Application.Restore;  //恢复
将trayicon1.enabled:=True; 就会自动缩小到状态栏

解决方案 »

  1.   

    報時的程序可以用Timer控件做,把它的Interval設為N分鐘,然后在它的onTimer事件中寫上
    Showmessage(formatdatetime('yyyy/mm/dd hh:mm:ss',now));
      

  2.   

    TrayIcon+Timer就可以不用Multithread
      

  3.   

    这是我在网上找到的代码:“某些程序运行启动后并不出现在任务条中,而是缩小为任务条右下角的一 
    个小图标,当鼠标移到这个小图标上时会出现一些提示信息、单击该小图标会 
    执行一些特定的操作。便如任务条右下角的小喇叭图标,单击它会弹出一个简 
    单的音量控制条,双击会启动另一个更大的音量控制程序。 
      在Shell32.DLL动态链接库中包括一个函数Shell_NotifyIconA()可通知 
    Windows在任务条右下角加入一个小图标,可惜该函数的详细说明未收入Delphi 
    的帮助文档中,下面以一个简单的实例来说明如果使用该函数。 unit Unit1; interface { 记住在uses部分中包括 ShellAPI} 
    uses 
    Windows, Messages, SysUtils, Classes, 
    Graphics, Controls, Forms, Dialogs, 
    ShellAPI, StdCtrls; {自定义消息,当小图标捕捉到鼠标事件时Windows向回调函数发送此消息} 
    {自定义消息,当小图标捕捉到鼠标事件时Windows向回调函数发送此消息} 
    const MY_MESSAGE = WM_USER + 100; type 
    TForm1 = class(TForm) 
    procedure FormCreate(Sender: TObject); 
    procedure FormClose(Sender: TObject; var Action: TCloseAction); 
    procedure FormPaint(Sender: TObject); 
    private 
    procedure OnIconNotify(var Message: TMessage); 
    message MY_MESSAGE; 
    public 
    { Public declarations } 
    end; var 
    Form1: TForm1; implementation {$R *.DFM} 
    {当小图标捕捉到鼠标事件时进入此过程} 
    {当小图标捕捉到鼠标事件时进入此过程} 
    procedure TForm1.OnIconNotify(var Message: TMessage); 
    const 
    Busy: Boolean = false; 
    begin 
    if not Busy then begin 
    Busy := true; 
    if Message.LParam=WM_LBUTTONDOWN then 
    if Application.MessageBox('Are you sure', 
    'Exit', MB_YESNO)=IDYES then Close; 
    Busy := false; 
    end; 
    end; {当主Form建立时通知Windows加入小图标} 
    procedure TForm1.FormCreate(Sender: TObject); 
    var 
    nid: TNotifyIconData; 
    begin 
    nid.cbSize := sizeof(nid); // nid变量的字节数 
    nid.Wnd := Handle; // 主窗口句柄 
    nid.uID := -1; // 内部标识,可设为任意数 
    nid.hIcon := Application.Icon.Handle; // 要加入的图标句柄,可任意指?
    nid.hIcon := Application.Icon.Handle; // 要加入的图标句柄,可任意指?nid.szTip := 'This is a test application'; // 提示字符串 
    nid.uCallbackMessage := MY_MESSAGE; // 回调函数消息 
    nid.uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE; // 指明哪些字段有?if not Shell_NotifyIcon(NIM_ADD, @nid) then begin 
    ShowMessage('Failed!'); 
    Application.Terminate; 
    end; 
    {将程序的窗口样式设为TOOL窗口,可避免在任务条上出现} 
    SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW); 
    end; {程序被关闭时通知Windows去掉小图标} 
    procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); 
    var 
    nid: TNotifyIconData; 
    begin 
    nid.cbSize := sizeof(nid); // nid变量的字节数 
    nid.cbSize := sizeof(nid); // nid变量的字节数 
    nid.uID := -1; //内部标识,与加入小图标时的数一致 
    nid.Wnd := Handle; //主窗口句柄 
    Shell_NotifyIcon(NIM_DELETE, @nid); //去掉小图标 
    Shell_NotifyIcon(NIM_DELETE, @nid); //去掉小图标 
    end; {主窗口初始化完毕并显示时将激活Paint重画事件,此时将主窗口隐藏} 
    procedure TForm1.FormPaint(Sender: TObject); 
    begin 
    Hide; 
    end; end. 上例中将程序的图标放在任务条右下角,然后隐藏自身,当用户移动鼠标 
    至该图标上时会看到提示字符串,如果单击该图标会出现一个对话框,选择Yes退出程序并清除小图标。 
    ”偶初学,搞不懂,能不能把该代码做的示例发到[email protected],第一个发的给80分,请帮忙,十分感谢!(请注明您在此的用户名,并且在此发一帖,以便加分)
      

  4.   

    上面的基本把技术都讲个差不多了。真的建议你看一下陈宽达的那本《Delphi深度历险》,里面的东西对你现在的这种状态很适合(当然不是全部适合,里面难度大的东西多着呢)。
      

  5.   

    同MYFIRST 和REAKY的方法,代码不多问题可解决。
      

  6.   

    参考一下吧
    unit fshbx;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, shellapi,
      Menus;const WM_NOTIFYICON = WM_USER + 1;
    type
      Tserverfrom = class(TForm)
        PopupMenu1: TPopupMenu;
        about1: TMenuItem;
        exit1: TMenuItem;
        Timer1: TTimer;
        procedure exit1Click(Sender: TObject);
        procedure about1Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
        procedure Timer1Timer(Sender: TObject);
      private
        Notifydata: Tnotifyicondata;
        procedure addicon;
        procedure removeicon;
        { Private declarations }
      protected
        procedure onnotifyicon(var message: TMessage); message WM_NOTIFYICON;
      public
        { Public declarations }
      end;
    var
      serverfrom: Tserverfrom;implementation{$R *.DFM}procedure Tserverfrom.addicon;
    begin
      notifydata.cbSize := sizeof(notifydata);
      with notifydata do
      begin
        wnd := handle;
        uid := 1;
        uflags := NIF_TIP or NIF_ICON or NIF_MESSAGE;
        hicon := application.Icon.Handle;
        sztip := '应用服务器';
        ucallbackmessage := WM_NOTIFYICON;
      end;
      shell_notifyicon(NIM_ADD, @notifydata);
    end;procedure Tserverfrom.removeicon;
    begin
      notifydata.uID := 1;
      shell_notifyicon(NIM_DELETE, @notifydata);
    end;procedure Tserverfrom.onnotifyicon(var message: Tmessage);
    var
      mousepos: Tpoint;
    begin
      if message.lparam = WM_LBUTTONDBLCLK then
        showmessage('不要乱动!')
      else
        if (message.lparam = WM_RBUTTONDBLCLK) then
        begin
          getcursorpos(mousepos);
          setforegroundwindow(application.handle);
          application.ProcessMessages;
          popupmenu1.Popup(mousepos.x, mousepos.y);
        end;
    end;procedure Tserverfrom.exit1Click(Sender: TObject);
    begin
      removeicon;
      close;
    end;procedure Tserverfrom.about1Click(Sender: TObject);
    begin
      showmessage('应用服务器');
    end;procedure Tserverfrom.FormCreate(Sender: TObject);
    begin
      addicon;
      showwindow(application.handle, SW_HIDE);
      Application.ShowMainForm := False;
    end;procedure Tserverfrom.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      removeicon;
    end;procedure Tserverfrom.Timer1Timer(Sender: TObject);
    begin
      //在此加定时代码
    end;end.
      

  7.   

    我把你的程序做了一边,不错很好使的!
    就是nid.uID :=-1;改成
    nid.uID :=0;就可以通过了!