Thanks guys - I understand this would only be useful on Windows, but
still would like it to work :)
The code below works fine in delphi - cant seem to get it to work with
Lazarus though.
I have commented the changes I have had to make to get it to compile /
run in Laz.
Any ideas ?
unit Unit1;
{$mode objfpc}{$H+}
interface
uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls, Windows, ShellApi;
const WM_ICONTRAY = WM_USER +1;
type
{ TForm1 }
TForm1 = class(TForm)
Image1: TImage;
procedure Form1Create(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
procedure TrayMessage( var Msg: TMessage ); message WM_ICONTRAY;
end;
var
Form1: TForm1;
TrayIconData :TNotifyIconData;
implementation
procedure TForm1.Form1Create(Sender: TObject);
begin
with TrayIconData do begin
cbSize := SizeOf(TrayIconData);
hWnd :=
Handle;
// delphi - Wnd := Handle;
uID := 0;
uFlags := NIF_MESSAGE + NIF_ICON + NIF_TIP;
uCallbackMessage := WM_ICONTRAY;
hIcon :=
0;
// delphi - hIcon := Application.Icon.Handle;
StrPCopy(szTip, Application.Title);
end;
Shell_NotifyIcon(NIM_Add,
PNOTIFYICONDATAA(@TrayIconData)); // delphi -
Shell_NotifyIcon(NIM_Add, @TrayIconData);
end;
procedure TForm1.TrayMessage( var Msg: TMessage );
begin
case Msg.lParam of
WM_LBUTTONDOWN: ShowMessage('Left button');
WM_RBUTTONDOWN: ShowMessage('Right button');
end;
end;
Initialization
{$I unit1.lrs}
Finalization
Shell_NotifyIcon(NIM_DELETE, PNOTIFYICONDATAA(@TrayIconData));
end.
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives