Hi,

I'm just wondering if I can rely on the ordinals of the shell32 icons, e.g. that the folder icon is ordinal 100 or whatever (it isn't, but for example)? I.e. if i do:



invoke LoadLibrary,SADD("shell32.dll")
invoke LoadIcon,eax,100
mov hIcon,eax


etc. will it work also in other versions of windows?

thanks.
Posted on 2004-01-22 16:09:25 by stormix
yes it will work but the user can change his settings to use a different icon so your app will only use the default icons wich may be different from what the user has chosen to use. I don't know how to find out what icon the user has chosen to use for disks, folders etc, registry keys maybe?
Posted on 2004-01-22 17:16:17 by ENF
You should never use LoadLibrary in that way. You are increasing the reference count on Shell32.dll and it could conceivably lead to problems when exiting your app. Use GetModuleHandle instead if you have already (most likely) loaded Shell32.dll. If you have not used any Shell functions in your app then you must use LoadLibrary but be sure to free it on exit.

invoke GetModuleHandle,SADD("shell32.dll")

invoke LoadIcon,eax,100
mov hIcon,eax


This will not increase the reference count on the DLL and you do not have to free the extra reference on exit.
Posted on 2004-01-22 17:50:27 by donkey
Thanks, i'll remember that. But the question i'm really asking is whether i can rely on the numbers of icon resources in shell32.dll across windows versions? For instance, the DLL icon is number 73 in my shell32.dll (windows xp); would it also be that in 2k and future windows versions?
Posted on 2004-01-23 05:28:25 by stormix
For the most part, I would say No.

Shell32 version checks show W9X & NT4 at 4.X and W2K at 5.X.
Just a quick checking between the two, shows many mis-matches. Not to mention the one you referenced.

Hey, just make your own and have some fun with it.

Regards, P1 :cool:
Posted on 2004-01-23 09:25:25 by Pone
Why don't you use the system image list - the first few items are always the same, irrespective of the OS you are running on.

There is a nice demo program at the following:

Shell icon demo

It also gives you info on how to retrieve any customized icons, so that your applications can use the same icons as the rest of the shell.

Nick
Posted on 2004-01-23 11:24:21 by Nick
Thanks for the replies, the shell icon article is very interesting :alright:
Posted on 2004-01-23 11:42:30 by stormix