Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. Having trouble with default icon for desktop app

Having trouble with default icon for desktop app

Scheduled Pinned Locked Moved Windows Forms
tutorialvisual-studiowindows-adminhelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mark F
    wrote on last edited by
    #1

    Using an icon editor I create the app icon. It contains 48x48, 2 - 32x32, and 2 - 16x16 images (five in all). The first three are for the application, the last two (32 & 16) are for the document file(s) associated with the application. The problem is that the DefaultIcon key in the registry does not associate the correct icon with the document files.

    Example:
    C:\Program Files\Test App\TestApp.exe,0 <- regardless the value the results are the same! X|

    Is there a "How to" for using icons with a VS 2005 Windows Form app? Thanks, Mark

    M 1 Reply Last reply
    0
    • M Mark F

      Using an icon editor I create the app icon. It contains 48x48, 2 - 32x32, and 2 - 16x16 images (five in all). The first three are for the application, the last two (32 & 16) are for the document file(s) associated with the application. The problem is that the DefaultIcon key in the registry does not associate the correct icon with the document files.

      Example:
      C:\Program Files\Test App\TestApp.exe,0 <- regardless the value the results are the same! X|

      Is there a "How to" for using icons with a VS 2005 Windows Form app? Thanks, Mark

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      I think you're getting caught out between how .NET handles resources and how Win32 does. Explorer uses the old Win32 model for resources; .NET has a new incompatible model. You also need to understand how icons work. Logically, each of the images in the same icon file represent the same icon. Windows or .NET pick the appropriate image out of the file depending on the size of the image requested (e.g. large vs small icons) and the screen colour depth (the system will use the highest available colour depth in the icon file that's less than or equal to the colour depth of the screen, for the requested icon size). If it doesn't have an icon in the requested size it will synthesize one by scaling up or down the icons that are available. What you need to do is separate your images into three icon files: one for the app, and one for each of the document files. You then need to build a Win32-style resource file using a resource script (.rc file) and the Win32 resource compiler, rc.exe, to generate a .res file. You can then go to the Application tab in the project properties in Visual Studio 2005 and select Resource File rather than Icon, and select the .res file you generated. I think you will need to add a version resource to the .rc file as well, if you want the Version tab to appear in Windows Explorer with your company name information.

      DoEvents: Generating unexpected recursion since 1991

      M 1 Reply Last reply
      0
      • M Mike Dimmick

        I think you're getting caught out between how .NET handles resources and how Win32 does. Explorer uses the old Win32 model for resources; .NET has a new incompatible model. You also need to understand how icons work. Logically, each of the images in the same icon file represent the same icon. Windows or .NET pick the appropriate image out of the file depending on the size of the image requested (e.g. large vs small icons) and the screen colour depth (the system will use the highest available colour depth in the icon file that's less than or equal to the colour depth of the screen, for the requested icon size). If it doesn't have an icon in the requested size it will synthesize one by scaling up or down the icons that are available. What you need to do is separate your images into three icon files: one for the app, and one for each of the document files. You then need to build a Win32-style resource file using a resource script (.rc file) and the Win32 resource compiler, rc.exe, to generate a .res file. You can then go to the Application tab in the project properties in Visual Studio 2005 and select Resource File rather than Icon, and select the .res file you generated. I think you will need to add a version resource to the .rc file as well, if you want the Version tab to appear in Windows Explorer with your company name information.

        DoEvents: Generating unexpected recursion since 1991

        M Offline
        M Offline
        Mark F
        wrote on last edited by
        #3

        Once I ran through the process of using the resource compiler (rc.exe) to create the .res file it occurred to me that I had done this before! Some time ago. :laugh: Now Windows Explorer shows the correct icons for the document files. Thanks for the help. Mark

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups