应该会有的。
1.确认你在Application.OnMessage的处理事件里定义了对自定义消息的处理
2.确认你确实发送了自定义消息
3.检查你的程序

解决方案 »

  1.   

    这个问题,你不会设置了form的属性吧
      

  2.   

    这是我的代码..........
    改用APPLICATION.OnMessage 还是不行,用WndProc加不进去
    unit Systray;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
    type
      PNotifyIconDataA = ^TNotifyIconDataA;
      PNotifyIconDataW = ^TNotifyIconDataW;
      PNotifyIconData = PNotifyIconDataA;
      {$EXTERNALSYM _NOTIFYICONDATAA}
      _NOTIFYICONDATAA = record
        cbSize: DWORD;
        Wnd: HWND;
        uID: UINT;
        uFlags: UINT;
        uCallbackMessage: UINT;
        hIcon: HICON;
        szTip: array [0..63] of AnsiChar;
      end;
      {$EXTERNALSYM _NOTIFYICONDATAW}
      _NOTIFYICONDATAW = record
        cbSize: DWORD;
        Wnd: HWND;
        uID: UINT;
        uFlags: UINT;
        uCallbackMessage: UINT;
        hIcon: HICON;
        szTip: array [0..63] of WideChar;
      end;
      {$EXTERNALSYM _NOTIFYICONDATA}
      _NOTIFYICONDATA = _NOTIFYICONDATAA;
      TNotifyIconDataA = _NOTIFYICONDATAA;
      TNotifyIconDataW = _NOTIFYICONDATAW;
      TNotifyIconData = TNotifyIconDataA;
      {$EXTERNALSYM NOTIFYICONDATAA}
      NOTIFYICONDATAA = _NOTIFYICONDATAA;
      {$EXTERNALSYM NOTIFYICONDATAW}
      NOTIFYICONDATAW = _NOTIFYICONDATAW;
      {$EXTERNALSYM NOTIFYICONDATA}
      NOTIFYICONDATA = NOTIFYICONDATAA;const
      {$EXTERNALSYM NIM_ADD}
      NIM_ADD         = $00000000;
      {$EXTERNALSYM NIM_MODIFY}
      NIM_MODIFY      = $00000001;
      {$EXTERNALSYM NIM_DELETE}
      NIM_DELETE      = $00000002;  {$EXTERNALSYM NIF_MESSAGE}
      NIF_MESSAGE     = $00000001;
      {$EXTERNALSYM NIF_ICON}
      NIF_ICON        = $00000002;
      {$EXTERNALSYM NIF_TIP}
      NIF_TIP         = $00000004;{$EXTERNALSYM Shell_NotifyIconA}
    function Shell_NotifyIconA(dwMessage: DWORD; lpData: PNotifyIconDataA): BOOL; stdcall;external 'shell32.dll';
    {$EXTERNALSYM Shell_NotifyIconW}
    function Shell_NotifyIconW(dwMessage: DWORD; lpData: PNotifyIconDataW): BOOL; stdcall;external 'shell32.dll';
    {$EXTERNALSYM Shell_NotifyIcon}
    function Shell_NotifyIcon(dwMessage: DWORD; lpData: PNotifyIconData): BOOL; stdcall;external 'shell32.dll';
    CONST
    WM_SystrayMessage=WM_USER+1000;
    Systray_MouseLDown=513;
    Systray_MouseRDown=516;
    Systray_MouseLUp=514;
    Systray_MouseRUp=517;
    Systray_MouseLDbl=516;
    Systray_MouseRDbl=518;
    type
      TSystray = class(TComponent)
      private
      FSystrayInfo:TNOTIFYICONDATA;
      FSystrayMouseMoveEvent:TNotifyEvent;//procedure (Sender: TObject) of object;
      FSystrayMouseLDownEvent:TNotifyEvent;
      FSystrayMouseRDownEvent:TNotifyEvent;
      FSystrayMouseLUpEvent:TNotifyEvent;
      FSystrayMouseRUpEvent:TNotifyEvent;
      FSystrayMouseLDblEvent:TNotifyEvent;
      FSystrayMouseRDblEvent:TNotifyEvent;
      FSystrayMouseLClickEvent:TNotifyEvent;
      FSystrayMouseRClickEvent:TNotifyEvent;
      PROCEDURE MessageProc(Var Msg:TMsg;var Handled: Boolean);
        { Private declarations }
      protected
        { Protected declarations }
      public  Procedure SystrayADDIcon(SICON:TNOTIFYICONDATA);
      Procedure SystrayDelIcon(SICON:PNOTIFYICONDATA);
      Procedure SystrayModIcon(SICON:PNOTIFYICONDATA);
        { Public declarations }
      published
      property SystrayInfo:TNOTIFYICONDATA read FSystrayInfo write SystrayADDIcon;
      property OnMouseMove:TNotifyEvent read FSystrayMouseMoveEvent write FSystrayMouseMoveEvent;
      property OnMouseLDOWN:TNotifyEvent read FSystrayMouseLDownEvent write FSystrayMouseLDownEvent;
      property OnMouseRDOWN:TNotifyEvent read FSystrayMouseRDownEvent write FSystrayMouseRDownEvent;
      property OnMouseLUP:TNotifyEvent read FSystrayMouseLUpEvent write FSystrayMouseLUpEvent;
      property OnMouseRUP:TNotifyEvent read FSystrayMouseRUpEvent write FSystrayMouseRUpEvent;
      property OnDblLClicK:TNotifyEvent read FSystrayMouseLDblEvent write FSystrayMouseLDblEvent;
      property OnDblRClick:TNotifyEvent read FSystrayMouseRDblEvent write FSystrayMouseRDblEvent;
      property OnLClick:TNotifyEvent read FSystrayMouseLClickEvent write FSystrayMouseLClickEvent;
      property OnRClick:TNotifyEvent read FSystrayMouseRClickEvent write FSystrayMouseRClickEvent;    { Published declarations }
      end;procedure Register;
    implementation
    Procedure TSystray.MessageProc(Var Msg:TMessage)Message WM_SystrayMessag;
    begin
    IF msg.WParam=7 then
    Case Msg.LParam of
    512:if Assigned(FSystrayMouseMoveEvent) then FSystrayMouseMoveEvent(self);
    513:if Assigned(FSystrayMouseLDownEvent) then FSystrayMouseLDownEvent(self);
    514:if Assigned(FSystrayMouseLUpEvent) then
    begin
    FSystrayMouseLUpEvent(self);
    if Assigned(FSystrayMouseLClickEvent) then FSystrayMouseLClickEvent(self);
    end;
    515:if Assigned(FSystrayMouseLDblEvent) then FSystrayMouseLDblEvent(self);
    516:if Assigned(FSystrayMouseRDownEvent) then FSystrayMouseRDownEvent(self);
    517:if Assigned(FSystrayMouseRUpEvent) then
    begin
    FSystrayMouseRUpEvent(self);
    if Assigned(FSystrayMouseRClickEvent) then FSystrayMouseRClickEvent(self);
    end;
    518:if Assigned(FSystrayMouseRDblEvent) then FSystrayMouseRDblEvent(self);
    end;
    inherited;end;Procedure TSystray.SystrayADDIcon(SICON:TNOTIFYICONDATA);
    begin
    SICON.uCallbackMessage:=WM_SystrayMessage;
    SICON.uFlags:=SICON.uFlags or NIF_MESSAGE;
    SICON.cbSize:=Sizeof(SICON);
    application.OnMessage:=MessageProc;
    If Not Shell_NotifyIcon(NIM_ADD,@SICON) then
    ShowMessage('系统图标添加错误');
    end;
    Procedure TSystray.SystrayDelIcon(SICON:PNOTIFYICONDATA);
    begin
    SICON^.uCallbackMessage:=WM_SystrayMessage;
    SICON^.uFlags:=SICON.uFlags or NIF_MESSAGE;
    SICON^.cbSize:=Sizeof(SICON);
    If Not Shell_NotifyIcon(NIM_DELETE,SICON) then
    ShowMessage('系统图标删除错误');
    end;
    Procedure TSystray.SystrayModIcon(SICON:PNOTIFYICONDATA);
    begin
    SICON^.uCallbackMessage:=WM_SystrayMessage;
    SICON^.uFlags:=SICON.uFlags or NIF_MESSAGE;
    SICON^.cbSize:=Sizeof(SICON);
    If Not Shell_NotifyIcon(NIM_MODIFY,SICON) then
    ShowMessage('系统图标修改错误');
    end;
    procedure Register;begin
      RegisterComponents('Win32', [TSystray]);
    end;end.
      

  3.   

    你的
    http://www.csdn.net/expert/topic/713/713598.xml?temp=.243725帖子
    没有必要。
    我已经删除。