Solved

Tray icon menu...

Posted on 1999-01-19
3
359 Views
Last Modified: 2010-04-02
Hi... I have a dialog based MFC app that has a static control on it. The static control displays a temperature reading that is changes at a time specified in a SetTimer function. The dialog can also be minimised to the tray. My question is this, if the user right clicks on the tray icon, how do I have the varying temperature reading as a menu item?
0
Comment
Question by:rose337
3 Comments
 
LVL 11

Accepted Solution

by:
alexo earned 50 total points
ID: 1184508
As a menu item???  I guess it is possible using the menu manipulation APIs but I guess it is much simpler to do it by changing the tooltip of the tray icon.

Try something like:

    NOTIFYICONDATA nid = { sizeof(NOTIFYICONDATA) };

    nid.hWnd = hwnd;
    nid.uID = IDI_TRAYICON;
    nid.uFlags = NIF_TIP;
    lstrcpy(nid.szTip, "whatever...");

    Shell_NotifyIcon(NIM_MODIFY, &nid);

This is not straight Win32 API code but you can easily adapt it to MFC...

0
 

Expert Comment

by:ahTri
ID: 1184509
Hi rose , I have nothing to contribute to your question just want to know how can u make the icon sit on the system tray instead of task bar
0
 

Author Comment

by:rose337
ID: 1184510
For AHTRI
Use NOTIFYTRAYICON structure and Shell_NotifyIcon. Also, refer to a previous question I had answered on that topic a few weeks ago.
Hope that helps; cheers
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

760 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

18 Experts available now in Live!

Get 1:1 Help Now