Simple Tray Icon
Create a multi-functional tray icon
Step 1:
Define a message to handle taskbar events
Your main form should look like this
const
  WM_TASKABAREVENT = WM_USER + $1;
Step 2:
Create a form
type
  TMainForm = class(TForm)
  private
    { Private declarations }
    NotifyIconData : TNotifyIconData;
    procedure TaskbarEvent(var Msg: TMessage); message WM_TASKABAREVENT;
  public
    { Public declarations }
  end;
.
.
.
.
.
procedure TMainForm.TaskbarEvent(var Msg: TMessage);
begin
  case Msg.lParam of
    WM_MouseMove     : Edit1.Text := 'MouseMove';
    WM_LButtonDown   : Edit1.Text := 'Left Button Down';
    WM_LButtonUp     : Edit1.Text := 'Left Button Up';
    WM_LButtonDblClk : Edit1.Text := 'Left Button DblClk';
    WM_RButtonDown   : Edit1.Text := 'Right Button Down';
    WM_RButtonUp     : Edit1.Text := 'Right Button Up';
    WM_RButtonDblClk : Edit1.Text := 'Right Button DblClk';
  end;
end;
Step 3:
Modify the OnCreate and OnDestroy Events
procedure TMainForm.FormCreate(Sender: TObject);
begin
  FillChar(NotifyIconData, SizeOf(TNotifyIconData), 0);
  NotifyIconData.cbSize           := Sizeof(NotifyIconData);
  NotifyIconData.Wnd              := Handle;
  NotifyIconData.uFlags           := NIF_MESSAGE or NIF_ICON or NIF_TIP;
  NotifyIconData.uCallbackMessage := WM_TASKABAREVENT;
  NotifyIconData.hIcon            := Application.Icon.Handle;
  NotifyIconData.szTip            := 'My Practice Icon';
  Shell_NotifyIcon(NIM_ADD, @NotifyIconData);
end;

procedure TMainForm.FormDestroy(Sender: TObject);
begin
  Shell_NotifyIcon(NIM_DELETE, @NotifyIconData);
end;
Home