Fog Creek Software
Discussion Board

Generating Windows Icons

I'm building a little application to show the current outdoor temperature in the system tray on Windows.

(Currently 104 F in Australia today!)

I am right in thinking that you can't directly display text in the system tray but can only use icons instead?

If so does anyone know of a way or a library of windows icons so I don't have to make an icon for all possible temperatures?

Matthew Lock
Sunday, February 9, 2003

I've made a similiar application to display the (very) local temperature in the system tray.

Here are some (slightly modified) function I've created for this:

HICON PaintIcon(double fTemp, COLORREF colorref) {
    HDC hScreenDC,hMemDC;
    HICON hIcon;
    ICONINFO IconInfo;
    char pszTemp[64];





    //draw the icon mask, to get correct transparancy
    DisplayText(hMemDC, 0x0, pszBlaat);

    //draw the temp in the correct colour.
    DisplayText(hMemDC, colorref, pszBlaat);    




    return hIcon;

void DisplayText(HDC hDC,COLORREF colorref,char *pszText) {

and you'll need



Use PaintIcon to get a handle to an icon you can use to draw the systray-icon. Don't forget to destroy it with DestroyIcon() after sending in to the systray.



Randy Simons
Sunday, February 9, 2003

If you are doing it in .Net, here is a project I did that puts the number of new mail messages in the system tray.  You should have no trouble adapting it to your needs.

Matt Watson
Monday, February 10, 2003

*  Recent Topics

*  Fog Creek Home