Having trouble with default icon for desktop app
-
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
-
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
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
-
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
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