|
Post by boggan on Jan 18, 2013 20:24:27 GMT 1
There seems to be no EASY way to extract icons from files. I want a function that can do this, and i do NOT want to use ExtractIcon coz that one suxx.
I want to be able to extract ALL icons (if there are any) in a file, no matter what kind of file. Ive been scouring the Gfa manual but all i can find are references to Listview.
I need a quick command that can extract the icon/icons, give me their resolution and then be able to handle the icon like i would any other bitmap gfx. Can someone help me, didnt think it would take so many lines of code to do something that should be a VERY basic function. It would also be nice to be able to add an icon to a exe without to much fuss.
Anyone else who has had headache from dealing with icons? I like the 256x256 icons , but is there no way to use icons with different sizes? Like the amiga, i dont like it that all icons are square.
|
|
|
Post by dragonjim on Jan 19, 2013 2:13:12 GMT 1
If by "extract an icon from a file", you mean load an icon file into a program, then the LoadPicture function is the one you need. If you read through the helpfile, the icon can also be resized up to 256 x 256.
However, if there are multiple icons in one file, then there I can't help you as I have never come across it.
Once the icon is loaded into the picture object, then all values can be derived from that object (see the helpfile) - NB: height and width are usually in himets, not pixels.
As well as changing the dimensions of the icon with the LoadPicture function (see above), it is also possible to give an icon the appearance of being an irregular shape by using layering and alpha blending. The best way to introduce that is through a dedicated art package - I use Gimp.
I'm not sure if the above has answered all of your questions, but I hope it has answered some.
|
|
|
Post by 649psoft2 on Jan 28, 2013 21:40:13 GMT 1
You have a project that wants to do a lot of things that are complex under the hood. You need to use API like: Declare Function DrawIcon Lib "user32.dll" Alias "DrawIcon" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long The index is the index of the image in the icon file (the last parameter in Extract Icon) and an icon file can contain several images in a database like format of different sizes similar to the outlook express .dbx which is a modified dbf structured kind of a file. return = ExtractIcon(frm1.hWnd, filename, 2) Although there are a lot of small examples available you also want to create show the size and save the Icon file in its format. MSDN has a c example. msdn.microsoft.com/en-us/library/ms997538.aspxYou can get some ideas from this to implement c style coding in gb32.
|
|