CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2004
    Posts
    32

    Problem with an icon in the TaskBar status area

    I'm writing a windows application that has an icon in the TaskBar status area. In order to do that I'm using Shell_NotifyIcon . Everything is ok except for one thing: the icon doesn't show very well.

    I've written a small web page in order to ilustrate what happens:
    http://ciberia.ya.com/dit6a9/

    Why does my application icon looks so awful in the TaskBar status area, especially when it looks perfectly in the Windows explorer?

    I've got another more question. As you see in the web page I've written to describe my problem, the .ico files actually contains 8 icons. How can I access every icon individually if for example I want to extract them? If I don't indicate anything, which is what I'm doing now, which icon is the one that Windows chooses to show in the TaskBar status area? Does Windows choose it automatically or is there any way I can indicate which to use? Do I have to do it?

  2. #2
    Join Date
    May 2004
    Location
    Michigan, United States
    Posts
    457
    From MSDN:

    Windows®. Windows 95, Windows 98, and Microsoft Windows NT® 4.0 support icons of up to 4 bits per pixel (BPP). Windows Millennium Edition (Windows Me) and Windows 2000 support icons of a color depth up to the current display mode. Windows XP supports icons of up to 32 BPP.

    What OS are you running?

    Edit: This refers to tray icons.
    Last edited by Bond; August 16th, 2004 at 03:16 PM.
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

  3. #3
    Join Date
    Aug 2004
    Posts
    32
    I'm using Windows 2000 and it is configured to 16 bits colors.

    The question is tha Windows explorer shows the icon perfectly, so my system is capable of showing this kind of icons but, why doesn't it seems to work when I set the icon programmatically?

  4. #4
    Join Date
    Oct 2002
    Location
    Italy
    Posts
    324
    Quote Originally Posted by Bond
    From MSDN:
    Windows®. Windows 95, Windows 98, and Microsoft Windows NT® 4.0 support icons of up to 4 bits per pixel (BPP). Windows Millennium Edition (Windows Me) and Windows 2000 support icons of a color depth up to the current display mode. Windows XP supports icons of up to 32 BPP.
    In my experience, all but Windows XP support 16-colour only icons.
    Regards,
    Marco Era
    www.marcoera.com

    Latest post on my blog: Back to the Amiga's times

  5. #5
    Join Date
    May 2004
    Location
    Michigan, United States
    Posts
    457
    Quote Originally Posted by dit6a9
    The question is tha Windows explorer shows the icon perfectly, so my system is capable of showing this kind of icons but, why doesn't it seems to work when I set the icon programmatically?
    That's why I added the note to say that it refers to tray icons only. They are limited in the number of colors they can use, pre-XP.

    For example, if you do this:
    Code:
    SendMessage(hwnd, WM_SETICON, ICON_SMALL, hIcon);
    you should see the icon the way you want to in the caption bar. As for the tray, you should design an icon specifically for it that uses a minimum number of colors, for pre-XP systems.
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

  6. #6
    Join Date
    Aug 2004
    Posts
    32
    I must confess I'm still a little bit confused. I'm going to attach some files to this post so that you can see clearly my problem.

    cube_blue.zip is the icon I'm trying to put in the system tray programatically, and pc-resolution.gif is a capture of my resolution settings. I'm using Windows 2000, as I mentioned before.

    cuble_blue.ico actually contains 8 icons, as you can see in img02.gif:

    001: 16x16 - 256 colors
    002: 16x16 - True colors
    003: 24x24 - 256 colors
    004: 24x24 - True colors
    005: 32x32 - 256 colors
    006: 32x32 - True colors
    007: 48x48 - 256 colors
    008: 48x48 - True colors

    Are you saying that Windows 2000 can't show none of these icons despite Windows Explorer really can, as you can see in img01.gif? Can Windows 2000 show only 16 colors icons in the system tray?

    If that's the point, I suppose I must write a rotuine to determine Windows version and put a particular icon depending on it, right?
    Attached Images Attached Images
    Attached Files Attached Files

  7. #7
    Join Date
    May 2004
    Location
    Michigan, United States
    Posts
    457
    I haven't downloaded your files yet, but yes, that's basically what I'm saying. The icons created in the tray notification area may only have a limited number of colors for all pre-Windows XP systems. For my machine, which has Windows 2000, it looks like a 16 or 32 color restriction.

    I have PGP and Outlook (obviously both are professional applications) running right now in my system tray and both of their tray icons are boring and dull in color. If I open Outlook, however, and look at the icon in the caption bar, it's very colorful. So, like I said, it's a restriction for the tray notification area only, for pre-XP systems.

    On my XP machine, which also has these programs installed, they have much cooler tray icons.
    Last edited by Bond; August 17th, 2004 at 03:07 PM.
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

  8. #8
    Join Date
    Aug 2004
    Posts
    32
    Many thanks, and forgive me for being a pain with my question! ;-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured