procedure TiButtonSecuritySystem.TaskBarAddIcon;
var
tnid: TNotifyIconData;
Owner: HWnd;
begin
with tnid
do
begin
cbSize := SizeOf(TNotifyIconData);
Wnd := iButtonSecuritySystem.Handle;
uID := 1;
uFlags := NIF_MESSAGE
or NIF_ICON
or NIF_TIP;
uCallbackMessage := WM_TASKBAREVENT;
hIcon := Application.Icon.Handle;
end;
StrCopy(tnid.szTip, '
iSS');
Shell_NotifyIcon(NIM_ADD, @tnid);
Owner:=GetWindow(iButtonSecuritySystem.Handle,GW_OWNER);
If Owner<>0
Then
ShowWindow(Owner,SW_HIDE);
end;
procedure TiButtonSecuritySystem.TaskBarRemoveIcon;
var
tnid: TNotifyIconData;
Owner: HWnd;
begin
tnid.cbSize := SizeOf(TNotifyIconData);
tnid.Wnd := iButtonSecuritySystem.Handle;
tnid.uID := 1;
Shell_NotifyIcon(NIM_DELETE, @tnid);
Owner:=GetWindow(iButtonSecuritySystem.Handle,GW_OWNER);
If Owner<>0
Then Begin
ShowWindow(Owner,SW_Show);
ShowWindow(Owner,SW_Normal);
End;
end;
procedure TiButtonSecuritySystem.WMTaskbarEvent(
var Message: TMessage);
var
Point: TPoint;
begin
case Message.LParamLo
of
WM_LBUTTONDOWN: showmessage('
ok');
WM_RBUTTONDOWN:
begin
SetForegroundWindow(
Handle);
GetCursorPos(point);
popupmenu1.popup(point.x,point.y);
end;
end;
end;
procedure TiButtonSecuritySystem.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
TaskBarRemoveIcon;
end;