Icones do Lado do Relogio
13/03/2003
0
Como eu faco para que meu programa fique do lado do relogio(bandeja) quando a janela for minimizada?
Neoramza
Curtir tópico
+ 0
Responder
Posts
13/03/2003
E_gama
Baixe e instale o componente abaixo e siga o projeto de exemplo que acompanha.
[url]http://www.salesiano.com.br/egama/trayicon.zip[/url]
[url]http://www.salesiano.com.br/egama/trayicon.zip[/url]
Responder
13/03/2003
Lfernandos
Declare a procedure na seção private do form
procedure WMTrayIcon(var Msg: TMessage); message WM_TRAYICON;
e antes de type TForm... declare a constante
const
WM_TRAYICON = WM_USER + 1;
procedure TfrmPrincipal.FormCreate(Sender: TObject);
var
NotifyIconData : TNotifyIconData;
begin
//Adiciona ícone na SysTray
with NotifyIconData do begin
cbSize := SizeOf(TNotifyIconData);
Wnd := Self.Handle;
uId := 0;
uCallBackMessage := WM_TRAYICON;
uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE;
hIcon := Application.Icon.Handle;
szTip := CTipTray;
end;
Shell_NotifyIcon(NIM_ADD, @NotifyIconData);
end;
procedure TfrmPrincipal.FormDestroy(Sender: TObject);
var
NotifyIconData : TNotifyIconData;
begin
//Remove o ícone da SysTray
with NotifyIconData do begin
cbSize := SizeOf(TNotifyIconData);
Wnd := Self.Handle;
uId := 0;
uFlags := 0;
end;
Shell_NotifyIcon(NIM_DELETE, @NotifyIconData);
end;
procedure TfrmPrincipal.WMTrayIcon(var Msg: TMessage);
begin
//Se clicou com o botão direito
if Msg.LParam = WM_RBUTTONUP then begin
PopupMenu.Popup(Mouse.CursorPos.x,Mouse.CursorPos.y);
end;
if Msg.LParam = WM_LBUTTONDBLCLK then begin
ExibeOculta(Self);
end;
end;
procedure WMTrayIcon(var Msg: TMessage); message WM_TRAYICON;
e antes de type TForm... declare a constante
const
WM_TRAYICON = WM_USER + 1;
procedure TfrmPrincipal.FormCreate(Sender: TObject);
var
NotifyIconData : TNotifyIconData;
begin
//Adiciona ícone na SysTray
with NotifyIconData do begin
cbSize := SizeOf(TNotifyIconData);
Wnd := Self.Handle;
uId := 0;
uCallBackMessage := WM_TRAYICON;
uFlags := NIF_ICON or NIF_TIP or NIF_MESSAGE;
hIcon := Application.Icon.Handle;
szTip := CTipTray;
end;
Shell_NotifyIcon(NIM_ADD, @NotifyIconData);
end;
procedure TfrmPrincipal.FormDestroy(Sender: TObject);
var
NotifyIconData : TNotifyIconData;
begin
//Remove o ícone da SysTray
with NotifyIconData do begin
cbSize := SizeOf(TNotifyIconData);
Wnd := Self.Handle;
uId := 0;
uFlags := 0;
end;
Shell_NotifyIcon(NIM_DELETE, @NotifyIconData);
end;
procedure TfrmPrincipal.WMTrayIcon(var Msg: TMessage);
begin
//Se clicou com o botão direito
if Msg.LParam = WM_RBUTTONUP then begin
PopupMenu.Popup(Mouse.CursorPos.x,Mouse.CursorPos.y);
end;
if Msg.LParam = WM_LBUTTONDBLCLK then begin
ExibeOculta(Self);
end;
end;
Responder
Clique aqui para fazer login e interagir na Comunidade :)