
Icon: Extract icon and save it as ico-file
Hi Oddbjorn,
after you extracract icon. Use DrawIcon function and
draw it to PictureBox (Name: Picture1; AutoRedraw=True; size 32x32pixels).
After it is drawn call SavePicture Picture1, "myicon.ico"
'== sample code==
micon = ExtractIcon(App.hInstance, "c:\windows\calc.exe", 0)
DrawIcon Picture1.hdc, 0, 0, micon
DestroyIcon micon
Picture1.Refresh
SavePicture Picture1.Image, "c:\file.ico" ' the icon size is 32x32, if the
picture if large than 32x32 the result icon is picture compressed to 32x32
'=====end======
The declarations of the functions you will find in API veiwer
that's all, good luck
Jan
=============================================
jK's Visual Basic page, http://freeweb.coco.cz/jankudr
=============================================
=============================================
Quote:
> Hi!
> Is it possible with some API-Calls to save a extracted icon to
> a ico-file? What I'm trying to do is to extract icon(s) from a
> .exe/.dll-file and save to .ico file(s). Or convert bitmaps to icons.
> I need to code this myself, so all these available utilities will not help
> me out :-(.
> Suggestions, links, ocx, or code will be apreciated!
> I found Q104570 ("Reading and Writing Icons from ExtractIcon") at
Microsoft
> KB, but this in C++ and I'm not sure if this is what I'm looking for.
> Regards,
> Oddbjorn Bersas
> Please reply to this NG only!