我需将调用DLL中的Form最小化后,在拖盘中显示图标,怎么实现?

解决方案 »

  1.   

    没试过,控件不行的话,自己写代码实现
    捕捉到dllForm最小化的消息就显示到托盘
      

  2.   

    分太少…………以后拒绝回答这么少分又这么麻烦的问题!
    //DLL
    library DLLICON;uses
      SysUtils,
      Classes,
      UScktFM in 'DLLForm.pas' {DM};{$R *.res}
    exports
        CreateForm,
        DestroyForm;
    begin
    end.//From
    unit DLLForm;interfaceuses
      Windows, Messages, SysUtils, Classes,   Forms,
      Dialogs, ShellAPI;type
      TDM = class(TForm)
        procedure FormCreate(Sender: TObject);
        procedure FormDestroy(Sender: TObject);
      private
        { Private declarations }
        IconData: TNotifyIconData;
        procedure AddIconToTray;
        procedure DelIconFromTray;  public
        { Public declarations }
      end;
    procedure CreateForm ; stdcall;
    procedure DestroyForm ; stdcall;
    var
      DM: TDM;
    implementation{$R *.dfm}procedure CreateForm ; stdcall;
    begin
        if DM = nil then
        begin
            DM := TDM.Create(Nil);
            DM.Show;        
        end;    
    end;procedure DestroyForm ; stdcall;
    begin
        if DM <> nil then
        DM.Free;
    end;procedure TDM.AddIconToTray;
    begin
        ZeroMemory(@IconData, SizeOf(TNotifyIconData));
        IconData.cbSize := SizeOf(TNotifyIconData);
        IconData.Wnd := Handle;
        IconData.uID := 1;
        IconData.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
        IconData.uCallbackMessage := WM_TrayIcon;
        IconData.hIcon := Self.Icon.Handle;
        IconData.szTip := 'DLL托盘图标';
        Shell_NotifyIcon(NIM_ADD, @IconData);
    end;procedure TDM.DelIconFromTray;
    begin
        Shell_NotifyIcon(NIM_DELETE, @IconData);
    end;procedure TDM.FormCreate(Sender: TObject);
    begin
        Self.AddIconToTray;
    end;procedure TDM.FormDestroy(Sender: TObject);
    begin
        Self.DelIconFromTray;
    end;end;
    //调用方法(静态)
    procedure CreateForm; stdcall; external DLLICON.dll'
    procedure DestroyForm; stdcall; external DLLICON.dll'
      

  3.   

    纠正一下;因为光顾着复制了……有个小马虎
    //DLL
    library DLLICON;uses
      SysUtils,
      Classes,
      DLLForm in 'DLLForm.pas' {DM};//这里改正{$R *.res}
    exports
        CreateForm,
        DestroyForm;
    begin
    end.
      

  4.   

    虽然在拖盘加了图标,但没有HIDE,我要的效果和CoolTrayIcon的相同,再顶!
      

  5.   

    我需将调用DLL中的Form最小化后,在拖盘中显示图标,怎么实现?靠,这不是你自己写的要求吗?赶紧给分!别扯蛋!