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?
rose337Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
alexoConnect With a Mentor Commented:
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.

All Courses

From novice to tech pro — start learning today.