Showing program in taskpane

How can i show my program on minimise and on load in the task pane in the bottom right hand corner near the time and the sound function?

This is instead of showing it as an application in the normal part of the task bar.

I hope you understand what i mean.

Regards,

Hypoviax
LVL 5
HypoviaxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

snehanshuCommented:
This question has been asked quite frequently.
There are some freeware components that let you do it without too much coding.
Here's a previously accepted answer:

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20774429.html

Accepted Answer from kretzschmar
Date: 10/22/2003 07:55PM IST
 Accepted Answer  

well, then just go to www.torry.net
go to search keyword trayicon

there are some free components,
download one or more install it
and drop it then one your form
 

*-*-* OR *-*-*

You could do a little bit programming like in this answer:
http://www-level3.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20743321.html

Accepted Answer from cubud
Date: 09/19/2003 04:20PM IST
 Accepted Answer  

Try this, it should work but I have typed it directly into the browser and might have a compile error.  Alternately you could get a trayicon component from Torry.net :-)

in Application.OnMinimize do this
ShowWindow(Application.Handle, SW_HIDE);

This will hide the app.  To show your own icon you need to use ShellAPI and do something like this

//You need this member in your main form
private
  FIconData: TNotifyIconData;

//Put this code in your main form's OnCreate
FIconData.cbSize := SizeOf(TNotifyIconData);
FIconData.Wnd := Handle;
FIconData.uID := 1;
FIconData.uFlags := NIF_MESSAGE or NIF_TIP or NIF_ICON;
FIconData.uCallbackMessage := WM_USER;
FIconData.hIcon := Application.Icon;
FIconData.szTip := PChar(Application.Title);
//Add the icon
Shell_NotifyIcon(NIM_ADD, @FIconData);

//Put this in OnDestroy of your main form
Shell_NotifyIcon(NIM_DELETE, @FIconData);

//Finally, you need to know when the icon in the tray is double clicked
private
  procedure WMUSER(var Message: TMessage); message WM_USER;

//implementation
procedure TForm1.WMUSER(var Message: TMessage);
begin
  if Message.LParam = WM_LBUTTONDBLCLK then
  begin
    ShowWindow(Application.Handle, SW_SHOW);
    Application.Restore;
    SetForegroundWindow(Application.Handle);
  end;
end;  


HTH,
...Snehanshu
0
geobulCommented:
Hi,

I use this skeleton in my apps (left-click on the tray icon opens the app and right-click opens the popup menu):

uses ..., ShellApi;

type
  TForm1 = class(TForm)
    PopupMenu1: TPopupMenu; // popup menu for the tray with two options: show and exit
    mnuTrayShow: TMenuItem;
    mnuTrayExit: TMenuItem;
     procedure ToTray;
     procedure FormCreate(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure mnuTrayShowClick(Sender: TObject);
    procedure mnuTrayExitClick(Sender: TObject);
  private
    { Private declarations }
  protected
    procedure WndProc(var Msg : TMessage); override;
  public
    { Public declarations }
    IconNotifyData : TNotifyIconData;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

uses unit2, Tools;

procedure TForm1.ToTray;
begin
  Form1.Hide;
end;

procedure TForm1.WndProc(var Msg : TMessage);
var
   p : TPoint;
begin
  case Msg.Msg of
    WM_USER+1:
    case Msg.lParam of
      WM_RBUTTONUP: begin // show popup menu with two options: show and exit
        GetCursorPos(p);
        PopupMenu1.Popup(p.x, p.y);
      end;
      WM_LBUTTONUP: begin
         mnuTrayShowClick(Self);
      end;
    end;
  end;
  if (Msg.Msg = WM_SYSCOMMAND) and (Msg.wParam = SC_MINIMIZE) then begin
    ToTray;
    Msg.wParam := 0;
    Msg.lParam :=0;
  end;
  inherited;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  with IconNotifyData do begin
    hIcon :=Application.Icon.Handle;
    uCallbackMessage := WM_USER + 1;
    cbSize := sizeof(IconNotifyData);
    Wnd := Handle;
    uID := 100;
    uFlags := NIF_MESSAGE + NIF_ICON + NIF_TIP;
  end;
  StrPCopy(IconNotifyData.szTip, 'CD FTP');
  Shell_NotifyIcon(NIM_ADD, @IconNotifyData);
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
  ShowWindow(Application.Handle, SW_HIDE);
  SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Shell_NotifyIcon(NIM_DELETE, @IconNotifyData);
  Application.ProcessMessages;
end;

procedure TForm1.mnuTrayShowClick(Sender: TObject);
begin
  Form1.Show;
  Application.BringToFront;
end;

procedure TForm1.mnuTrayExitClick(Sender: TObject);
begin
  Close;
end;

end.

Regards, Geo
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HypoviaxAuthor Commented:
Thanks for your help i believe that both were equal,

Snehanshu,

Please go to http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20793756.html for your equal share

Reagrds,

Hypoviax

0
geobulCommented:
Thanks Hypoviax :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.