Set an icon for a file type
I have used Qt Creator and created my.exe file and a new extension ".newext" and have manually associated .newext files to the my.exe like this.
The exe file has as its icon which is square figure and named myIcon.ico. I have described in myapp.rc file the icon like this:
IDI_ICON1 ICON DISCARDABLE "myIcon.ico"
Also in a .pro file I have added this line:
RC_FILE = myapp.rc
Now when I set for .newext extension in registry the value of DefaultIcon key e开发者_Go百科qual to
C:\path\to\my.exe,0
then I see the squere icon for the file that I have associated to my.exe
When I set
C:\path\to\my.exe,1
then there is no icon recognized.
What to set for the value in order to see as an icon the white paper (wrapped at the top-right corner) and on that my square icon - a little bit made smaller?
P.S. I know that it should be possible without specifying a new resource in the .exe file because when I say to Vista "Open with my.exe always", then it puts the icon I described above (of course without changing my .exe).
I don't know if it is possible at all. I haven't seen any application doing that. What you would have to do is to discover how the Windows creates these icons and run this mechanism to create one, then associate generated icon to your file type. It may be somewhere deep inside the Windows.
My advise is not don't do this, draw your own icon.
精彩评论