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

Tray icon menu...

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
rose337
Asked:
rose337
1 Solution
 
alexoCommented:
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
 
ahTriCommented:
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
 
rose337Author Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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