CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 14 of 14
  1. #1
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    [RESOLVED] Main app icon mostly for Vista but also compatible with XP

    Hi everyone:


    I'm trying to make a main icon for my application using Vista icons recommendations (with sizes up to 256x256). If I save it using PNG compression the file becomes quite manageable, but the icon doesn't show in Windows XP. Otherwise (without compression) the icon file itself balloons to almost 500KB.

    Is there any way to include two images as an app's main icon, one for Vista/7 with PNG compression and one for Windows XP?

  2. #2
    Join Date
    Nov 2007
    Posts
    35

    Re: Main app icon mostly for Vista but also compatible with XP

    See the LoadImage() API. Also you can use either GetVersion() or GetVersionEx() to determine the OS you are on and load the icon you want using the resource ID. There must be tons of examples on the web. It varies though with the type of application. If it's a dialog app you do it a bit differently from a standard window or form app. You could even just copy the icon files to the install folder. Stuff doesn't have to be compiled into the .exe file.

    edit: I think I misunderstood the question. If you mean the icon that Explorer will show for your program then I think your choices are to either make the included icon XP compatible, or use an installer that detects the OS and installs the appropriate version of the .exe file. I looked into customizing the icon for stuff like the Start Menu and it's a nightmare. Better to just use one .exe for Vista and later, and another for XP. Of course more detail can get a better answer. I'm assuming your program consists of a single stand-alone native .exe file.

    Another approach may be to decrease the color depth. How that will look depends on the individual icon.
    Last edited by MilesAhead; October 11th, 2010 at 07:52 AM.

  3. #3
    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    379

    Re: Main app icon mostly for Vista but also compatible with XP

    Hi,

    Do you need to use the large images under XP? If not, you should be able to save them in PNG format, and the smaller images as BMP. The ICO file format allows you to used different compression methods for different icon sizes.

    Alan

  4. #4
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Main app icon mostly for Vista but also compatible with XP

    Guys, I'm obviously talking about the main app icon that I'd like to include in the executable file (the one that has IDR_MAINFRAME id in an MFC project).

  5. #5
    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    379

    Re: Main app icon mostly for Vista but also compatible with XP

    Hi,

    >Guys, I'm obviously talking about the main app icon
    Yes, I think you said basically that in your first post.

    If you use an ICO file, and compress the large images using PNG, and leave the others (48x48 or less) in bitmap format, does that not work for you? If not, please could you explain what problem you see and when, and how you are adding the ICO file to your program resources?

    Alan

  6. #6
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Main app icon mostly for Vista but also compatible with XP

    Can an .icn file contain some images compressed with PNG and some uncompressed? If so, what software do you use to make those?

  7. #7
    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    379

    Re: Main app icon mostly for Vista but also compatible with XP

    Hi,

    I use IcoFX http://icofx.ro/ , by default it will use PNG compression for 256x256 images. I don't think you can use it to compress images at other resolution, but the ICO file format does support that.

    Alan

  8. #8
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Main app icon mostly for Vista but also compatible with XP

    OK, I thought so. And here comes my whole point -- I can compress the whole .ico file using PNG compression but then it won't open under XP. So I guess my only solution is to make an uncompressed icon, hah...

  9. #9
    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    379

    Re: Main app icon mostly for Vista but also compatible with XP

    Hi,

    >I guess my only solution is to make an uncompressed icon, hah...
    Sorry, I still don't understand why you don't want to compress the high resolution icons with PNG, and leave the rest uncompressed.

    What's wrong with this layout (for example) in the ICO file:
    256x256 32bit image (PNG compression, use for Vista/7 only)
    32x32 24bit image (not compressed)
    16x16 24bit image (not compressed)
    32x32 4bit image (not compressed)
    16x16 4bit image (not compressed)

    Do you mean you want to use the 256x256 icon under XP somehow?

    Alan

  10. #10
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Main app icon mostly for Vista but also compatible with XP

    Thanks. Maybe. I need to try this approach. The software I've been using doesn't really allow you to compress only selected formats.

  11. #11
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Main app icon mostly for Vista but also compatible with XP

    OK, it worked. It's basically this dumb software I was using to make icons. It had an option hidden in the menu to specify which component image of an .ICN file should be compressed with PNG. For some reason I took it that the entire .ICN file will be compressed.

  12. #12
    Join Date
    Nov 2007
    Posts
    35

    Re: Main app icon mostly for Vista but also compatible with XP

    Quote Originally Posted by ahmd View Post
    OK, it worked. It's basically this dumb software I was using to make icons. It had an option hidden in the menu to specify which component image of an .ICN file should be compressed with PNG. For some reason I took it that the entire .ICN file will be compressed.
    Can you say what tool you are using? I've been using SimplyIcon but it seems to max out at 48 or 64 pixels. I'm looking for a Vista compatible icon maker that generates from a .png image.

  13. #13
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: [RESOLVED] Main app icon mostly for Vista but also compatible with XP

    I went through several myself and settled on Axialis IconWorkshop. It's a paid one but I got comped by the company I work for...

    PS. The reason I chose it is also because it makes icons for Macs, which I also develop for.

  14. #14
    Join Date
    Nov 2007
    Posts
    35

    Re: [RESOLVED] Main app icon mostly for Vista but also compatible with XP

    Thanks for the info. I'm trying IcoFX. Looks good for a donation-ware. I'll know more when I try to create my own with it. So far I've just created from an existing image.

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