?
Solved

Adding a program to taskbar in windows 2000

Posted on 2003-02-20
6
Medium Priority
?
277 Views
Last Modified: 2010-05-18
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
Comment
Question by:ermancel
[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
6 Comments
 
LVL 49

Accepted Solution

by:
DanRollins earned 136 total points
ID: 7986058
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
 
LVL 3

Assisted Solution

by:cmaryus
cmaryus earned 132 total points
ID: 7986070
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
 
LVL 1

Assisted Solution

by:rainbowsix
rainbowsix earned 132 total points
ID: 7986640
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!

 
LVL 2

Expert Comment

by:udil
ID: 8868864
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
 
LVL 49

Expert Comment

by:DanRollins
ID: 8872297
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
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 9355994
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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

765 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