Solved

Tray icon menu...

Posted on 1999-01-19
3
380 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

777 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