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

x
?
Solved

icon communicating with application

Posted on 1998-06-29
5
Medium Priority
?
136 Views
Last Modified: 2010-04-04
How do i make an icon at the taskbar communicate with my applicantion. For example: when i right click on the icon i want to make a popup menu appears.
0
Comment
Question by:lifeson
[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
5 Comments
 
LVL 5

Expert Comment

by:ronit051397
ID: 1356264
You mean in the system tray:
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
 

Author Comment

by:lifeson
ID: 1356265
This answer appears in other qustion already. i made this but when i click at the icon, nothing heappens. Please, i want more dettails about it.
0
 
LVL 6

Expert Comment

by:Holger101497
ID: 1356266
make sure to write

TForm1= ....
   PROCEDURE WndProc(var MyMessage: TMessage); OVERRIDE; //IMPORTANT... if you don't override, nothing will happen...

Did that solve the problem?
0
 
LVL 3

Accepted Solution

by:
Matvey earned 100 total points
ID: 1356267
http://bes.trendline.co.il/torry/vcl/system/tstrayv1.zip
"By T. J. Sobotka. Adds a system tray icon for your application. "

http://bes.trendline.co.il/torry/vcl/system/systray.zip
"By SCV Systems. The TscvSysTray component places an icon in the Win95 System Tray (lower right corner of taskbar). Mouse events are detected, and returned to the TscvSysTray object, giving you easy access to these messages. When the user clicks your system tray icon, for example, the TscvSysTray object fires an OnClick message."

http://bes.trendline.co.il/torry/vcl/system/astray.zip
"By Andrey Abakumov. ASTrayIcon allows you use icon in Windows Taskbar area (animated and non-animated). Also has ability to remove your task from Taskbar. "

http://bes.trendline.co.il/torry/vcl/system/trayicon.zip
"By Troels Jakobsen. Another tray icon component, but this one generates standard events, where you can actually check for mousebuttons, keystates, cursor position, etc."

http://bes.trendline.co.il/torry/vcl/system/tray11.zip
By Martin Djernæs. TmdTray is a component which offer a icon in the Windows 95 / NT4.0 tray. TmdTray can use icons from resources, accept hotkeys for the PopupMenu used and automaticly update of the tray, when the connected icon is changed. "

-Torry's Delphi page.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1356268
As Holger says, Did you write override?
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

661 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