我现在采用的是TBusinessSkinForm作为调整界面样式的控件,采用的是TRzTray作为托盘控件,因为这个托盘控件可以显示动画。
但是,现在当我把主窗口最小化后,所产生的所有窗口(主窗口,还有一些其他打开的窗口),全部最小化到托盘了。我现在想要:主窗口最小化到托盘,主窗口不要出现在任务栏,其他窗口照样打开不动,其他窗口可以出现在任务栏上。
-------------------------
TBusinessSkinForm的最小化源码如下:
procedure TbsBusinessSkinForm.DoMinimize;
var
  P: TPoint;
begin
  if (Application.MainForm = FForm)
  then
    begin
      Application.Minimize
    end
  else
    begin
      if IsNullRect(OldBoundsRect)
      then OldBoundsRect := FForm.BoundsRect;
      P := GetMinimizeCoord;
      FForm.SetBounds(P.X, P.Y, GetMinWidth, GetMinHeight);
      if (FForm.FormStyle = fsMDIChild) and (FWindowState <> wsMaximized)
      then
        begin
          SendMessage(Application.MainForm.Handle, WM_MDICHILDRESTORE, 0, 0);
        end;
    end;
end;
请问如何修改????我试过消息处理没有效果,代码如下:
procedure TForm1.WMSysCommand(var Message: TWMSysCommand);
begin
  with Message do
  begin
    if CmdType and $FFF0 = SC_MINIMIZE then
      ShowWindow(Handle, SW_MINIMIZE)
    else inherited;
  end;
end;
请问现在如何修改????非常感激!!!!!

解决方案 »

  1.   

    你要是想让子窗体不随主窗体的最小化而最小化,需要重载子窗体的
    procedure CreateParams(var Params:TCreateParams);override;
    ////////////////////////////////////////////////////////
    procedure Tfrm_child.CreateParams(var Params: TCreateParams);
    begin
      inherited CreateParams(Params);
      Params.WndParent := GetDesktopWindow;
    end;
      

  2.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,ShellAPI,
      StdCtrls, Menus;const
      WM_TRAYNOTIFY = WM_USER+100;type
      TForm1 = class(TForm)
        PopupMenu1: TPopupMenu;
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
        procedure TrayNotifyMessage(var Sender: TMessage); message WM_TRAYNOTIFY;
        procedure MarkTaskBarIcon(Sender: TObject);
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      tnd : TNOTIFYICONDATA;
    implementation{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
    begin
       Application.OnMinimize := MarkTaskBarIcon;
    end;procedure TForm1.MarkTaskBarIcon(Sender: TObject);
    begin
       Form1.Visible := False;
       tnd.cbSize := sizeof(tnd);
       tnd.Wnd := Handle;
       tnd.uID := 128;
       tnd.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
       tnd.uCallbackMessage := WM_TRAYNOTIFY;
       tnd.hIcon := Application.Icon.Handle;
       StrPCopy(tnd.szTip,Application.Title);
       Shell_NotifyIcon(NIM_ADD,@tnd);
    end;procedure TForm1.TrayNotifyMessage(var Sender: TMessage);
    begin
       if Sender.LParam = WM_LBUTTONDBLCLK then
      begin
        Shell_NotifyIcon(NIM_DELETE,@tnd);
        Form1.Visible := True;
        Application.Restore;
        Application.BringToFront;
      end;
         if  wm_size=1 then
         
    end;end. 
    --------------------
    不晓得这个可不可以