Click to See Complete Forum and Search --> : How build small icon and large icon in a vb application?
Bon La Lay
February 15th, 2001, 02:51 AM
I want to make my vb program a small icon and a large one. That means when we
browse the file in "explore" of windows, it can display small icon and large
icon after user select the view type of "Large Icons" and "Small Icons". In VC
we can do it in the resource file, but in VB, how ?
Urgent!
//-----------------------------------------\\
Where there's a wire , there's a way
\\-----------------------------------------//
Chris Locke
February 15th, 2001, 03:33 AM
Explorer handles converting the 16x16 icon if none exists - which is normal for a VB application.
If you assign a normal 32x32 icon to a form (via the icon property) and compile the exe, on the Options you can specify what icon you want to give the exe (only one though).
In Explorer, it then 'reduces' the 32x32 large icon to give a 16x16 icon in list, small icon, and report views.
If this is not the case for you, let me know...
Bon La Lay
February 15th, 2001, 06:04 AM
That's the problem. I want to make the Explore display my own another 16*16 icon when we
change the "views type" to Small Icons. Means I want to insert two different icons in the
VB programe and Windows can handle.
//-----------------------------------------\\
Where there's a wire , there's a way
\\-----------------------------------------//
Bon La Lay
February 15th, 2001, 06:05 AM
That's the problem. I want to make the Explore display my own another 16*16 icon when we
change the "views type" to Small Icons. Means I want to insert two different icons in the
VB programe and Windows can handle.
//-----------------------------------------\\
Where there's a wire , there's a way
\\-----------------------------------------//
Clearcode
February 15th, 2001, 08:56 AM
A .ico file can store more than one actual icon in it.
If you store the 32x32 icon then the 16x16 icon in the one file and assign this file to VB form, does explorer pick up the correct version?
-------------------------------------------------
Got "BigMetalHead"? You will soon
http://www.merrioncomputing.com
Bon La Lay
February 15th, 2001, 09:57 PM
Really?
How to store 16x16 and 32x32 icons into only one .ico file?
Thanks.
//-----------------------------------------\\
Where there's a wire , there's a way
\\-----------------------------------------//
Clearcode
February 16th, 2001, 03:10 AM
An icon file always starts with a structure called the ICONDIR structure.
In VB this structure would be:
Type ICONDIR
idReserved as Integer 'not used in Win32
idType as Integer 'Always set to 1 in Win32
idCount as Integer 'Number of icons in this file
End Type
Following that are however many the value in ICONDIR.idCount times a structure known as an ICONDIRENTRY.
Type ICONDIRENTRY
bWidth as Byte '16,32 or 64 pixels wide
bHeight as Byte 'Should match bwidth
bColourCount as Byte
bReserved 'must be set to zero
wPlanes as Integer 'number of colour planes
wBitCount as Integer 'bits per pixel
dwBytesInRes as Long 'size of icon at default res
dwImageOffset as Long 'Start of image offset from start of file
End Type
Using this windows will look through every ICONDIRENTRY in an icon file and display the nearest match to your display characteristics. Only if no match is found will it alter another icon.
There should be an editor that supports this - probably in MSDN. If not, let me know and I will add it to the list of things that I will cover in my "BigMetalHead" column and let yopu know when this is done.
HTH,
Duncan
-------------------------------------------------
Got "BigMetalHead"? You will soon
http://www.merrioncomputing.com
Chris Locke
February 16th, 2001, 04:06 AM
If you go to download.com and type 'icon editor' it should find a fair few dozen...
Its shareware, but powerful (and no, I didn't write it!) but IconForge is good...
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.