Ver Mensaje Individual
  #2  
Antiguo 04-05-2006
Avatar de TheWatcher
TheWatcher TheWatcher is offline
Registrado
 
Registrado: may 2006
Posts: 7
Reputación: 0
TheWatcher Va por buen camino
RE: consulta sobre focos

este codigo me lo pasaron a mi hace rato aunq no lo probe del todo
pero parece q lo q hace es q cuando cierras el programa te lo deja en el systray y lo puedes volver a abrir o algo asi.
algunas cosas estan en ingles porq asi me lopasaron.

haber si lo pueds hacer correr ,creo q es lo q quieres



In your uses statement, include 'shellapi'.

Create a program constant like this:

WM_NOTIFYICON = WM_USER+333;

At the end of your procedure listing for your form include these lines:

private
{ Private declarations }
tnid: TNotifyIconData;
HMainIcon: HICON;
procedure CMClickIcon(var msg: TMessage); message WM_NOTIFYICON;

The actual procedure looks like this:

procedure TForm.CMClickIcon(var msg: TMessage);
begin
case msg.lparam of
WM_LBUTTONDBLCLK, WM_LBUTTONDOWN : Show;
end;
end;

In your TForm.FormCreate procedure include these lines:

HMainIcon := LoadIcon(MainInstance, 'MAINICON');

Shell_NotifyIcon(NIM_DELETE, @tnid);

tnid.cbSize := sizeof(TNotifyIconData);
tnid.Wnd := handle;
tnid.uID := 123;
tnid.uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
tnid.uCallbackMessage := WM_NOTIFYICON;
tnid.hIcon := HMainIcon;
tnid.szTip := 'Volume Control';

Shell_NotifyIcon(NIM_ADD, @tnid);

In your TForm.FormClose procedure add these lines:

Action := caNone;
Hide;
Responder Con Cita