Ver Mensaje Individual
  #4  
Antiguo 02-08-2007
Avatar de Enan0
Enan0 Enan0 is offline
Miembro
 
Registrado: may 2004
Ubicación: Argentina
Posts: 565
Reputación: 23
Enan0 Va por buen camino
Yo para Eso no suelo utilizar un componente!! aca te dejo este codigo que hace lo mismo


Código:
// En el private del Form

    IconData: TNotifyIconData;
    Procedure SysCommand(var msg: TWMSysCommand);Message WM_SYSCOMMAND;
    Procedure ActivarFrom(Var msg:TMESSAGE);Message WM_USER+1;

....................



procedure TForm1.FormCreate(Sender: TObject);
begin
  //Le asigno el Icono de La aplicacion
   With IconData do
      begin
        cbsize:=sizeof(icondata);
        wnd:=Handle;
        uID:=100;
        uFlags:= NIF_MESSAGE+NIF_ICON + NIF_TIP;
        uCallBackMessage:= WM_User +1;
        hIcon:=application.Icon.Handle;
        StrPCopy(szTip,Application.Title);
      end;
//Agrega el Icono
    shell_NotifyIcon(NIM_ADD,@IconData);
end;

procedure TForm1.SysCommand(var msg: TWMSysCommand);
begin
   if (Msg.CmdType = SC_minimize) or (msg.CmdType=SC_CLOSE) then
     begin
        With IconData do
          begin
            cbsize:=sizeof(icondata);
            wnd:=Handle;
            uID:=100;
            uFlags:= NIF_MESSAGE+NIF_ICON + NIF_TIP;
            uCallBackMessage:= WM_User +1;
            hIcon:=application.Icon.Handle;
            StrPCopy(szTip,Application.Title);
          end;
//Lo Asigno al SystemTry
        shell_NotifyIcon(NIM_ADD,@IconData);
//Lo saco de la Barra de TAreas
        hide;
     end
   else
      DefaultHandler(msg);
end;

procedure TForm1.ActivarFrom(var msg: Tmessage);
var P:Tpoint;
begin
   IF MSG.lPAram = WM_LBUTTONDOWN then
      form1.show
   else
      if msg.LParam = WM_RBUTTONDOWN THEN
       begin
          SetForegroundWindow(Handle);
          GetCursorPos(p);
          PopupMenu1.Popup(p.x, p.y);
          PostMessage(Handle, WM_NULL, 0, 0);
       end;
end;


// Si no queres que la aplicaacion se cierre cuando click en Cerrar en el form close

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
var
   msg:TWMSysCommand;
begin
if not salida then begin
   canclose:=false;
   msg.CmdType :=SC_minimize;
   SysCommand(msg);
   end
else
   canclose:=true;
end;

Saludos y espero que te sea de ayuda
Responder Con Cita