Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Showing program in taskpane

Posted on 2003-11-09
4
Medium Priority
?
542 Views
Last Modified: 2010-04-05
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
0
Comment
Question by:Hypoviax
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Expert Comment

by:snehanshu
ID: 9712164
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
 
LVL 17

Accepted Solution

by:
geobul earned 500 total points
ID: 9714599
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
 
LVL 5

Author Comment

by:Hypoviax
ID: 9719082
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
 
LVL 17

Expert Comment

by:geobul
ID: 9720565
Thanks Hypoviax :-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question