Solved

How can I make an Icon at the TaskBar? ie. the volume control!

Posted on 1998-06-18
5
155 Views
Last Modified: 2011-09-20
I'm making an app that i need to put an icon at the Windows TaskBar, but i don't think how to do.
0
Comment
Question by:chuckwicked
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:ronit051397
Comment Utility
You mean on the system tray?
0
 
LVL 1

Expert Comment

by:Greedy
Comment Utility
if you want to associate an icon with the application go to
Project | Options then click on the Application tab and press the load icon button.

if you want to add the icon to the system try I sugest you get a component called ASTrayIcon it is based on the RxLibraries and is available from DSP (http://sunsite.icm.edu.pl/delphi/) Or tell me this is what you want and I'll give you the source.

if you want to create an entry in the start menu you can copy a shortcut into a directory under <\Windows\Start Menu>

0
 
LVL 1

Expert Comment

by:Greedy
Comment Utility
oh BTW the system tray is that little bevel on the right side of the start bar and it usualy has a clock in it.
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
Yes, there are lot's of components that put an icon to the system tray.

The best is to look at torry.rimini.com -easy to find there what you need...
0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 100 total points
Comment Utility
   Place 3 buttons for Add, Delete and modify the Icon in the TaskBar.
    Place a Popup menu with some items and write the following code:

    uses ShellAPI;
    .
    var IconData :TNotifyIconData;
    ..
    procedure TForm1.bbAddClick(Sender: TObject);
    begin
      with IconData DO
      begin
        cbSize := SizeOf(IconData);
        uFlags := NIF_ICON OR NIF_TIP OR NIF_MESSAGE;
        uID := 0;
        Wnd := Handle;
        szTip := 'This is my Application'+#0;
        hIcon := Application.Icon.Handle;
        uCallBackMessage := WM_USER+$10;
      end;
      if Shell_NotifyIcon(NIM_ADD,@IconData) then MessageBeep(0);
    end;

    procedure TForm1.bbModifyClick(Sender: TObject);
    begin
      with IconData do
      begin
        szTip := 'app is modified'+#0;
        hIcon := LoadIcon(0,IDI_ASTERISK);
      end;
      if Shell_NotifyIcon(NIM_MODIFY,@IconData) then MessageBeep(0);
    end;

    procedure TForm1.bbDeleteClick(Sender: TObject);
    begin
      if Shell_NotifyIcon(NIM_DELETE,@IconData) then MessageBeep(0);
    end;

    procedure TForm1.WndProc(var MyMessage: TMessage);
    var CursorPos: TPoint;
    begin
      IF MyMessage.Msg = WM_USER+$10 THEN
      CASE MyMessage.LParam OF
      WM_RBUTTONUP :
      BEGIN
        GetCursorPos(CursorPos);
        PopupMenu1.Popup(CursorPos.X, CursorPos.Y);
      END;
      WM_LBUTTONDBLCLK :
      ShowMessage('This is my application');
      END;
      INHERITED WndProc(MyMessage);
    end;
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

728 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now