05-01-2005, 02:02 AM
I was wondering, is it possible to save a icon with just SavePicture(MyIcon.ico)?? And if not, how else to do this?
05-01-2005, 04:52 AM
The SavePicture(Picture1.picture, <FileName>) method will normally save back to the format the picture was originally loaded in. If you use the Picture1.image method I believe it saves only to .bmp.
There is a way to save other formats with the GDI plus API but I am not familiar with it.
Another cheesy method would be to use the shell command to run a third party command line graphics conversion program after you saved to bmp.
Check out the ico file format here:
05-01-2005, 02:22 PM
Would you be interested in a function like...
Public Function SaveIcon(Optional ByVal sFileName As String = "") As Boolean
Saves the current icon resources to a .ICO file. If sFileName is not specified, the file that the icon was loaded from will be used. Returns True if successful, or False otherwise. An error will be raised if there is any problem saving the icon.
...if so, you may want to check out:
Reading and Saving .ICO files and resources in VB
However, if you want to create the special create 32-bit icons (with alpha channels in multiple sizes) using Windows XP you might want to take a look at the code in this utility:
Alpha Icon Creator Utility