在delphi7中怎么使窗口最小化后显示到任务栏上?????
本人急切等待高人解答!!!!!!!

解决方案 »

  1.   

    self.windowstate:=wsminimized后,窗口最小化到左下角,而没有最小化到任务栏上
      

  2.   

    http://search.csdn.net/expert/topic/53/5302/2002/3/22/592267.htm
      

  3.   

    http://search.csdn.net/expert/topic/53/5301/2002/1/22/490640.htm
      

  4.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      application.Minimize;  //這樣不可以嗎?
    end;
      

  5.   

    看看关于WM_SYSCOMMAND消息的文档,你会发现更多的东西。
      

  6.   

    托盘程序
    unit MainFrm;interface{ 记住在uses部分中包括 ShellAPI }
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ShellAPI, ExtCtrls;{ 自定义消息,当小图标捕捉到鼠标事件时 Windows 向回调函数发送此消息 }
    const MY_MESSAGE = WM_USER + 100;type
      TMainForm = class(TForm)
        Timer1: TTimer;
        procedure OnIconNotify(var Message: TMessage);
        message MY_MESSAGE;    procedure FormCreate(Sender: TObject);
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
        procedure FormPaint(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      MainForm: TMainForm;implementation{$R *.dfm}{ 当小图标捕捉到鼠标事件时进入此过程 }
    procedure TMainForm.OnIconNotify(var Message: TMessage);
    var
       Busy : Boolean;
    begin
       Busy := False;
       if not Busy then
       begin
          Busy := True;
          if Message.LParam=WM_LBUTTONDOWN then
             if Application.MessageBox('真的要退出日志定时清楚程序吗?', '提示', MB_YESNO)=IDYES then
                Close;
          Busy := False;
       end;
    end;{ 当主Form建立时通知windows加入小图标 }
    procedure TMainForm.FormCreate(Sender: TObject);
    var
       nid: TNotifyIconData;
    begin
       nid.cbSize := sizeof(nid);  // nid 变量的字节数
       nid.Wnd := Handle;  // 主窗口句柄
    //   nid.uID := -1;  // 内部标识,可设为任意数
       nid.hIcon := Application.Icon.Handle;  // 要加入的图标句柄,可任意指定
       nid.szTip := '定时清楚日志'; //提示字符串
       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 TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
    var
       nid: TNotifyIconData;
    begin
       nid.cbSize := sizeof(nid);  // nid变量的字节数
    //   nid.uID := -1;  // 内部标识,与加入小图标时的数一致
       nid.Wnd := Handle;  //主窗口句柄
       Shell_NotifyIcon(NIM_DELETE, @nid);  //去掉小图标
    end;{ 主窗口初始化完毕并显示时将激活 Paint 重画事件, 此时将主窗口隐藏 }
    procedure TMainForm.FormPaint(Sender: TObject);
    begin
       Hide;
    end;procedure TMainForm.Timer1Timer(Sender: TObject);
    var
      Hand : THandle;
    begin
      Hand := OpenEventLog('192.168.0.11','Application');  //打开本地日志
      ClearEventLog(Hand,'c:\dd.evt');  //清除日志,指定备份文件
      CloseEventLog(Hand);     //关闭句柄
      DeleteFile('c:\dd.evt');  //删除备份文件
      Hand := OpenEventLog('192.168.0.11','System');
      ClearEventLog(Hand,'c:\dd.evt');
      CloseEventLog(Hand);
      DeleteFile('c:\dd.evt');
    end;end.
      

  7.   

    application.Minimize;  
    api也可以啊。