Discussion:
Shell32.dll icons
(too old to reply)
Dan Kelly
2008-02-29 12:37:00 UTC
Permalink
Hi

I am using Delphi to develop applications for Windows XP and wondering about
using the standard icons from Shell32.dll on my toolbar.

I've been trying to track down the usage rights fror these icons and getting
mixed messages.

Basically:

1) Can I use the icons from Shell32.dll in my application?

If so can I :

2) Extract the images to load the ones I want into a Delphi TImagelist?

or

3) Do I have to load the full Shell32.dll list using the API calls?

Finally

4) Can I base my icons on the standard icons if there are any missing?

Cheers

Dan
Paul Baker [MVP, Windows - SDK]
2008-02-29 14:25:16 UTC
Permalink
Dan,

You are probably getting mixed answers because you are asking mixed or
unclear questions. I'll just try to answer a bunch of questions and you go
ahead and pick one :)

You can't just use any icon resource you want in Shell32.dll, because the
resource IDs could change or an icon could be removed in any build. However,
people do it and so Microsoft probably tries to minimize that.

You can use SHGetFileInfo, or make use of shell interfaces, to get an HICON
or image list handle and icon index to any object in Explorer (a file, file
type, folder, virtual folder, virtual item) which could be from Shell32.dll,
another system DLL or any other file.

Some icons used commonly by the shell are actually in ComCtl32.dll, and can
be loaded by sending a TB_LOADIMAGES message to a toolbar.

I use Delphi myself, and I sometimes find it convenient to copy these images
to a TImageList. Let me know which icons you are looking for and I will help
you with the code.

Paul
Post by Dan Kelly
Hi
I am using Delphi to develop applications for Windows XP and wondering about
using the standard icons from Shell32.dll on my toolbar.
I've been trying to track down the usage rights fror these icons and getting
mixed messages.
1) Can I use the icons from Shell32.dll in my application?
2) Extract the images to load the ones I want into a Delphi TImagelist?
or
3) Do I have to load the full Shell32.dll list using the API calls?
Finally
4) Can I base my icons on the standard icons if there are any missing?
Cheers
Dan
Dan Kelly
2008-02-29 14:40:00 UTC
Permalink
Thanks Paul,

The nub of the question is really:

"Am I allowed to?"

The icons I'm looking to use in my toolbar are the standard Undo, Delete,
Open and New icons...

Cheers
Post by Paul Baker [MVP, Windows - SDK]
Dan,
You are probably getting mixed answers because you are asking mixed or
unclear questions. I'll just try to answer a bunch of questions and you go
ahead and pick one :)
You can't just use any icon resource you want in Shell32.dll, because the
resource IDs could change or an icon could be removed in any build. However,
people do it and so Microsoft probably tries to minimize that.
You can use SHGetFileInfo, or make use of shell interfaces, to get an HICON
or image list handle and icon index to any object in Explorer (a file, file
type, folder, virtual folder, virtual item) which could be from Shell32.dll,
another system DLL or any other file.
Some icons used commonly by the shell are actually in ComCtl32.dll, and can
be loaded by sending a TB_LOADIMAGES message to a toolbar.
I use Delphi myself, and I sometimes find it convenient to copy these images
to a TImageList. Let me know which icons you are looking for and I will help
you with the code.
Paul
Post by Dan Kelly
Hi
I am using Delphi to develop applications for Windows XP and wondering about
using the standard icons from Shell32.dll on my toolbar.
I've been trying to track down the usage rights fror these icons and getting
mixed messages.
1) Can I use the icons from Shell32.dll in my application?
2) Extract the images to load the ones I want into a Delphi TImagelist?
or
3) Do I have to load the full Shell32.dll list using the API calls?
Finally
4) Can I base my icons on the standard icons if there are any missing?
Cheers
Dan
David Lowndes
2008-02-29 15:49:14 UTC
Permalink
Post by Dan Kelly
"Am I allowed to?"
The icons I'm looking to use in my toolbar are the standard Undo, Delete,
Open and New icons...
MS ship a load of freely usable images in Visual Studio. If you have a
VS license you could presumably use those.

Dave
Paul Baker [MVP, Windows - SDK]
2008-02-29 17:23:17 UTC
Permalink
Dave,

Doesn't Visual Studio just use the ones that come with Windows? Anyway, Dan
is using Delphi.

Dan,

You want to use TB_LOADIMAGES like this:

ToolBar:= TToolBar.CreateParented(Application.Handle);
try
ToolBar.Images:= MyImageList;
ToolBar.Perform(TB_LOADIMAGES, MyBitmapID, LPARAM(HINST_COMMCTRL));
finally
ToolBar.Free;
end;

MyImageList is your TImageList.

MyBitmapID would be IDB_STD_LARGE_COLOR or IDB_STD_SMALL_COLOR.

Your image indexes would be STD_UNDO, STD_DELETE, STD_FILEOPEN and
STD_FILENEW.

TB_LOADIMAGES Message:
http://msdn2.microsoft.com/en-us/library/bb787381(VS.85).aspx

Toolbar Standard Button Image Index Values:
http://msdn2.microsoft.com/en-us/library/bb760433(VS.85).aspx

Paul
Post by David Lowndes
Post by Dan Kelly
"Am I allowed to?"
The icons I'm looking to use in my toolbar are the standard Undo, Delete,
Open and New icons...
MS ship a load of freely usable images in Visual Studio. If you have a
VS license you could presumably use those.
Dave
Dan Kelly
2008-02-29 17:33:02 UTC
Permalink
Paul,

That looks great - will try it out over the weekend.

I take it from the above that MS have no problem with the STD_* images being
used in commercial apps?
Post by Paul Baker [MVP, Windows - SDK]
Dave,
Doesn't Visual Studio just use the ones that come with Windows? Anyway, Dan
is using Delphi.
Dan,
ToolBar:= TToolBar.CreateParented(Application.Handle);
try
ToolBar.Images:= MyImageList;
ToolBar.Perform(TB_LOADIMAGES, MyBitmapID, LPARAM(HINST_COMMCTRL));
finally
ToolBar.Free;
end;
MyImageList is your TImageList.
MyBitmapID would be IDB_STD_LARGE_COLOR or IDB_STD_SMALL_COLOR.
Your image indexes would be STD_UNDO, STD_DELETE, STD_FILEOPEN and
STD_FILENEW.
http://msdn2.microsoft.com/en-us/library/bb787381(VS.85).aspx
http://msdn2.microsoft.com/en-us/library/bb760433(VS.85).aspx
Paul
Post by David Lowndes
Post by Dan Kelly
"Am I allowed to?"
The icons I'm looking to use in my toolbar are the standard Undo, Delete,
Open and New icons...
MS ship a load of freely usable images in Visual Studio. If you have a
VS license you could presumably use those.
Dave
Paul Baker [MVP, Windows - SDK]
2008-02-29 20:33:11 UTC
Permalink
Dan,

Um... if they do they should have said so in the documentation. It looks
like this message was designed for the very purpose you intend it to.
Microsoft wants to encourage consistency of certain UI elements, I think.

Paul
Post by Dan Kelly
Paul,
That looks great - will try it out over the weekend.
I take it from the above that MS have no problem with the STD_* images being
used in commercial apps?
Post by Paul Baker [MVP, Windows - SDK]
Dave,
Doesn't Visual Studio just use the ones that come with Windows? Anyway, Dan
is using Delphi.
Dan,
ToolBar:= TToolBar.CreateParented(Application.Handle);
try
ToolBar.Images:= MyImageList;
ToolBar.Perform(TB_LOADIMAGES, MyBitmapID, LPARAM(HINST_COMMCTRL));
finally
ToolBar.Free;
end;
MyImageList is your TImageList.
MyBitmapID would be IDB_STD_LARGE_COLOR or IDB_STD_SMALL_COLOR.
Your image indexes would be STD_UNDO, STD_DELETE, STD_FILEOPEN and
STD_FILENEW.
http://msdn2.microsoft.com/en-us/library/bb787381(VS.85).aspx
http://msdn2.microsoft.com/en-us/library/bb760433(VS.85).aspx
Paul
Post by David Lowndes
Post by Dan Kelly
"Am I allowed to?"
The icons I'm looking to use in my toolbar are the standard Undo, Delete,
Open and New icons...
MS ship a load of freely usable images in Visual Studio. If you have a
VS license you could presumably use those.
Dave
Loading...