• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 279
  • Last Modified:

Adding a program to taskbar in windows 2000

In VC++ how can I add an icon in the taskbar status area(bottom right, beside system time) whenever the computer is started??  In other words, the program will be  running, but there is now window open , but the icon is there to confirm the program is running.
Erman
0
ermancel
Asked:
ermancel
3 Solutions
 
DanRollinsCommented:
That is called the "status" area of the taskbar, and is often referred to thas the "tray" and the icon as a "tray icon"  All such programs use the Shell_NotifyIcon API function.  Using these keywords, you can find lots of info.

You need to write a small program, probably dialog-based that handle Tray Icon notifications.  Here is a sample from the Microsoft samples:

     http://support.microsoft.com/default.aspx?scid=KB;en-us;q200786

but there are many other descriptions and complete projects available here at EE and all over the web.

-- Dan
0
 
cmaryusCommented:
First create an icon resource, let's say IDI_ICON1.
The place the icon in the system tray:

nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = m_hWnd;
nid.uID = ID_TASKBARICON;
nid.uFlags = NIF_ICON|NIF_MESSAGE|NIF_TIP;
nid.uCallbackMessage = WM_ICONNOTIFY;
nid.hIcon = (HICON)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON, 16, 16, 0);
strcpy(nid.szTip, "my icon...");
Shell_NotifyIcon(NIM_ADD, &nid);

When the user make an action on the icon you receive the message: WM_ICONNOTIFY.Tou can handle this message:

BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
     //{{AFX_MSG_MAP(CMyDlg)
     ON_MESSAGE(WM_ICONNOTIFY, OnIconNotify)
     //}}AFX_MSG_MAP
END_MESSAGE_MAP()

LRESULT CMyDlg::OnIconNotify(WPARAM wParam, LPARAM lParam)
{
     switch(lParam)
     {
          case WM_LBUTTONDBLCLK:
               {
                    AfxMessageButton("Left button dbl click");
               }
               break;
          case WM_RBUTTONUP:
               {
                    AfxMessageButton("Right button up");
                 }
            break;
         default:
               {
                    return FALSE;
               }            
     }
     return TRUE;
}
0
 
rainbowsixCommented:
http://codeguru.earthweb.com/shell/TrayLght.html might be a overkill for you, but surely ll get all you need
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
udilCommented:
This question has been abandoned. I will make a recommendation to the moderators on its resolution in a week or two. I appreciate any comments that would help me to make a recommendation.

In the absence of responses, I may recommend DELETE unless it is clear to me that it has value as a PAQ. Silence = you don't care.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Udil
EE Cleanup Volunteer
0
 
DanRollinsCommented:
I object.  
There is good PAQ-able info here.   My link provides a complete example and as the first such answer, it should be awarded the points.  I would not object to a split.

-- Dan
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Grade of A, split equally between:

DanRollins
Rainbowsix
cmaryus

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Ged
EE Cleanup Volunteer
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now