News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

ImageList Export ?

Started by guga, September 18, 2014, 03:10:57 PM

Previous topic - Next topic

guga

Someone have a working example on how to save the contents of a imagelist ?

In delphi files, the imagelist is a kind of structure starting with "IL" bytes.

I´m trying to retrieve the info from an external imagelist (iml file i suppose) and extract from it their icons, bitmaps etc.

I found 3 examples but they are in .NET  :(
http://stackoverflow.com/questions/1729417/how-to-export-images-from-an-image-list-in-vs2005
https://onedrive.live.com/?cid=ff58a5e0db16681c&id=FF58A5E0DB16681C!137
http://www.codeproject.com/Articles/13096/Extract-images-from-private-ImageLists
http://www.codeproject.com/Articles/13573/Extracting-Embedded-Images-From-An-Assembly


Perhaps using ImageList_Read, but...how to extract it´s contents ? I mean, ot from a imagelist form a dll/exe...but from a imagelist file itself (iml ?) that starts with the magic signature "IL"



2 closer examples i found in VB6 and Autohotkey
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=57737&lngWId=1
http://www.autohotkey.com/board/topic/67252-imagelist-saveloadloadressaveasbmp-viewer/

how can the extraction be done ?
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

TouEnMasm

Here a sample ,but in french,with a combobox using images in an imagelist and loading them in a stream
You need the CreateStreamOnHGlobal function
http://codes-sources.commentcamarche.net/source/15323-masm32-combobox-a-images-et-common-controls
Fa is a musical note to play with CL

guga

Many Tks ives, i´ll tale a look

I really like this site. I often find some nice examples on cppfrance.com and on asmfrance.com

About the CreateStreamOnHGlobal where you got that information ? On the autohotkey link ?
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

dedndave

i don't think i ever tried the code in this thread of the old forum (second post)

http://www.masmforum.com/board/index.php?topic=7749

but, it might at least give you some ideas

TouEnMasm

Quote
About the CreateStreamOnHGlobal where you got that information ? On the autohotkey link ?

I have added a sample link control,follow the links he give.
The first common control link give source code in C.
it is the one to refer when you want something about control.
An Imagelist is a control.
Fa is a musical note to play with CL

guga

Tks guys

i´ll take a look

The idea is retrieve the bitmaps, icons nd cursors from a delphi Imagelist dfm file. Inside a dfm file we have several components and one of them is a ImageList starting with those magic signatures.

The format is something like


seg000:000007E0 MainImageListStart dd 1126h ----> Size of imagelist
seg000:000007E4 aIl             db 'IL' -----> magic signature
seg000:000007E6                 dw 101h ----> ???
seg000:000007E8 IML_FrameCount  dw 1 -----> frame count ? unlikely...It seems to be an index of some sort because the file contains 2 bitmap images
seg000:000007EA                 dw 4 -----> ? Horizontal resolution ???? 4*16 = 64
seg000:000007EC                 dw 4 -----> ?
seg000:000007EE IML_Width_CX    dw 16
seg000:000007F0 IML_Height_CY   dw 16
seg000:000007F2                 dw 0FFFFh -----> ???
seg000:000007F4                 dw 0FFFFh -----> ???
seg000:000007F6                 dw 10FFh -----> ???
seg000:000007F8 Rect            dw 0FFFFh >---- rect coords ????
seg000:000007FA                 dw 0FFFFh
seg000:000007FC                 dw 0FFFFh
seg000:000007FE                 dw 0FFFFh
seg000:00000800 aBm_0           db 'BM'
seg000:00000802                 dd 36h
seg000:00000806                 dd 0
seg000:0000080A                 dd 36h
seg000:0000080E                 dd 28h


This is only a structure, but the main problem is identify what is what.

Internally delphi uses a function called:
__fastcall Imglist::TCustomImageList::ReadData(Classes::TStream *)

that read the contents of this, including the "IL" signature, and uses their values to set onto a imagelist to be properly read and later be extracted each bitmap on another function.

I´m posting here a iml file i created from a delphi one, that contains the IL header (preceded by the dword representing the file lenght), the corresponding bitmap edited with hexworkshop from this iml file, and the generated bitmap.

One of the structures are related to the background color of the image and other to a mask, but i don´t know which is which.

There are 3 files generated from the delphi function. One is the regular image and other is it´s mask saved in bitmap. ANd the othyer is a ico file that is generated from it.


For example. A starting point i had was to analyze the structure of a TBitmap inside a dmf, which have the following format:

   [TData:
     TData.Size: D$ XXXX ; the total size of  the data
     TData.TBitMap.SigNameLen: B$ 7
     TData.TBitMap.SigName: B$ 'TBitMap'
     TData.TBitMap.Size: D$ 0 ; size of the bitmap
     Tdata.BinaryData: B$ XXXX; the contents of the bitmap.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com