Icons - How to gain access to the Mask, image as well as the Color-table : ExtractIcon 
Author Message
 Icons - How to gain access to the Mask, image as well as the Color-table : ExtractIcon
Hello All,

  I got the idea to extract some icons from a file (a filing-cabinet), and
change the colors somewhat, after which I wanted/could use them as visual
clues for certain file-types (ZIP, ARJ, RAR, LZH, etc).

The grabbing of the origional Icon, using the DLL_function ExtractIcon went
quite well, and placing it into a PictureBox (so I could view them) went
well allso.

But Now I'm stuck.  My idea was to change some entries in the icon's
color-table, and save it again.  At that point I bumped into problems :

1) I can't seem to be able to find where the mask, imag & color data of the
icon (of which I only have an hIcon-handle received from the
"ExtractIcon"-call) recide ...

2) There seems to be no (easy) way to save an icon again ... :-\

If anyone has got an idea of how to retrieve the memory-adresses of those
three items (mask, image & color) I would be in their debth ...

If anyone has a(n simple) method to save the icon-data in memory to an
Icon-file I would be again in their debth :-)

Regards,
  Rudy Wieser

P.s.
My exuses for the cross-postings, but I've asked the question before, and
got no answer to it.  Now I'm trying to reach an as large as possible
"audience" :-)



Wed, 29 Jun 2005 21:20:50 GMT  
 Icons - How to gain access to the Mask, image as well as the Color-table : ExtractIcon

Quote:
>   I got the idea to extract some icons from a file (a filing-cabinet), and
> change the colors somewhat, after which I wanted/could use them as visual
> clues for certain file-types (ZIP, ARJ, RAR, LZH, etc).

> The grabbing of the origional Icon, using the DLL_function ExtractIcon
went
> quite well, and placing it into a PictureBox (so I could view them) went
> well allso.

> But Now I'm stuck.  My idea was to change some entries in the icon's
> color-table, and save it again.  At that point I bumped into problems :

> 1) I can't seem to be able to find where the mask, imag & color data of
the
> icon (of which I only have an hIcon-handle received from the
> "ExtractIcon"-call) recide ...

You want the GetIconInfo() API call for this, which will return among other
things, the handles to the API Bitmap's containing both the mask and colour
data.

Quote:
> 2) There seems to be no (easy) way to save an icon again ... :-\

> If anyone has got an idea of how to retrieve the memory-adresses of those
> three items (mask, image & color) I would be in their debth ...

> If anyone has a(n simple) method to save the icon-data in memory to an
> Icon-file I would be again in their debth :-)

Saving the icon is a little more tricky, AFAIK there is no built-in API
functionality to save the new icon out to disk, it's somewhat of a one-way
process.  I've written my own custom icon support that takes care of the
file I/O so if the worst comes to the worst then you could always do the
same (To a lesser extent).  Have a look at the format specification from
Http://www.wotsit.org/ and find out how to write an hIcon to a file, you
should have access to all the data you require to write it and the format is
dead easy too and you shouldn't have any problems but let me know if you run
into any problems.
Hope this helps,

    Mike

 -- EDais --

 - Microsoft Visual Basic MVP -
WWW: Http://EDais.earlsoft.co.uk/




Wed, 29 Jun 2005 22:42:06 GMT  
 Icons - How to gain access to the Mask, image as well as the Color-table : ExtractIcon


Hello Mike,

Quote:
> >   I got the idea to extract some icons from a file (a filing-cabinet),
> > and change the colors somewhat, after which I wanted/could use
> > them as visual clues for certain file-types (ZIP, ARJ, RAR, LZH,
> > etc).

> > The grabbing of the origional Icon, using the DLL_function
> > ExtractIcon went quite well, and placing it into a PictureBox (so
> > I could view them) went well allso.

> > But Now I'm stuck.  My idea was to change some entries in the
> > icon's color-table, and save it again.  At that point I bumped into
> > problems :

> > 1) I can't seem to be able to find where the mask, image & color
> > data of the icon (of which I only have an hIcon-handle received
> > from the "ExtractIcon"-call) recide ...

> You want the GetIconInfo() API call for this, which will return
> among other things, the handles to the API Bitmap's containing
> both the mask and colour data.

Yes, I've seen that call before.  It returns two handles, one to the BitMask
data, and one to the Color-data.   But after that I'm again stuck ....   For
some reason I than have to do/should be doing a number of things, like
retrieving (?) the icon's bitmap-header (that does not want to match with
the Icon I just loaded :-(  ), and some other stuff, like with the
Device-Context, which feels like I'm busy making a detour around the world,
when all I seek to do is to get my hands on on the icon-data of the
just-extracted icon ...

- Show quoted text -

Quote:
> > 2) There seems to be no (easy) way to save an icon again ... :-\

> > If anyone has got an idea of how to retrieve the memory-adresses of
those
> > three items (mask, image & color) I would be in their debth ...

> > If anyone has a(n simple) method to save the icon-data in memory to an
> > Icon-file I would be again in their debth :-)

> Saving the icon is a little more tricky, AFAIK there is no built-in API
> functionality to save the new icon out to disk, it's somewhat of a one-way
> process.  I've written my own custom icon support that takes care of the
> file I/O so if the worst comes to the worst then you could always do the
> same (To a lesser extent).  Have a look at the format specification from
> Http://www.wotsit.org/ and find out how to write an hIcon to a file, you
> should have access to all the data you require to write it and the format
is
> dead easy too and you shouldn't have any problems but let me know if you
run
> into any problems.

Well, that part I've allready nailed-down.  With aid of exactly the site
you're suggesting I've retrieved the description of how the icon-file should
look like. I'm able to, by way of a very crude re-assembly of an on-screen
Icon (in an image-box)  (scanning it pixel-by-pixel to re-create the
Color-table for example) to generate a (somewhat) acceptable icon-file.  So,
it should not be a problem (anymore :-)

Quote:
> Hope this helps,

It does, thanks

Regards,
  Rudy Wieser



Thu, 30 Jun 2005 03:15:39 GMT  
 Icons - How to gain access to the Mask, image as well as the Color-table : ExtractIcon

Quote:
> Yes, I've seen that call before.  It returns two handles, one to the
BitMask
> data, and one to the Color-data.   But after that I'm again stuck ....
For
> some reason I than have to do/should be doing a number of things, like
> retrieving (?) the icon's bitmap-header (that does not want to match with
> the Icon I just loaded :-(  )

Yes, the Bitmap's returned by ExtractIcon() are Device Dependant Bitmap's
and as such bound to screen resolution (Or always 1-bpp in the case of the
mask).  Here's an example of how to use the function to retrieve the
information if you or anyone else needs it:

'***
Private Declare Function GetIconInfo Lib "user32" _
    (ByVal hIcon As Long, ByRef piconinfo As IconInfo) As Long

Private Declare Function GetObject Lib "gdi32" Alias _
    "GetObjectA" (ByVal hObject As Long, _
    ByVal nCount As Long, ByRef lpObject As Any) As Long

Private Declare Function ExtractIcon Lib "shell32.dll" _
    Alias "ExtractIconA" (ByVal hInst As Long, _
    ByVal lpszExeFileName As String, _
    ByVal nIconIndex As Long) As Long

Private Declare Function DeleteObject Lib "gdi32" _
    (ByVal hObject As Long) As Long

Private Declare Function DestroyIcon Lib "user32" _
    (ByVal hIcon As Long) As Long

Private Type IconInfo
    fIcon As Long
    xHotspot As Long
    yHotspot As Long
    hbmMask As Long
    hbmColor As Long
End Type

Private Type Bitmap ' 14 bytes
    bmType As Long
    bmWidth As Long
    bmHeight As Long
    bmWidthBytes As Long
    bmPlanes As Integer
    bmBitsPixel As Integer
    bmBits As Long
End Type

Private Sub Form_Load()
    Dim IconInf As IconInfo
    Dim MaskBMInf As Bitmap
    Dim ColourBMInf As Bitmap
    Dim hIcon As Long

    ' Extract the icon from the file
    hIcon = ExtractIcon(App.hInstance, _
        "C:\WinNT\System32\Shell32.dll", 0)

    If (hIcon) Then
        ' Grab the icon information
        Call GetIconInfo(hIcon, IconInf)

        ' Grab the Bitmap information
        Call GetObject(IconInf.hbmMask, _
            Len(MaskBMInf), MaskBMInf)
        Call GetObject(IconInf.hbmColor, _
            Len(ColourBMInf), ColourBMInf)

        ' Display what we got back
        Call MsgBox("[ Icon ]:" & vbCrLf & _
            "Icon: " & CBool(IconInf.fIcon) & vbCrLf & _
            "Hotspot: " & IconInf.xHotspot & ", " & _
            IconInf.yHotspot & vbCrLf & _
            vbCrLf & "[ Mask ]:" & vbCrLf & _
            BMInfToSting(MaskBMInf) & vbCrLf & _
            vbCrLf & "[ Colour ]:" & vbCrLf & _
            BMInfToSting(ColourBMInf), _
            vbInformation, "Icon info")

        ' Delete source bitmaps (They're only copies)
        Call DeleteObject(IconInf.hbmColor)
        Call DeleteObject(IconInf.hbmMask)

        ' Clean up icon
        Call DestroyIcon(hIcon)
    End If
End Sub

Private Function BMInfToSting(ByRef inInf As Bitmap) As String
    With inInf
        BMInfToSting = "Type: " & .bmType & vbCrLf & _
            "Width: " & .bmWidth & vbCrLf & _
            "Height: " & .bmHeight & vbCrLf & _
            "WidthBytes: " & .bmWidthBytes & vbCrLf & _
            "Planes: " & .bmPlanes & vbCrLf & _
            "BitsPixel: " & .bmBitsPixel & vbCrLf & _
            "Bits(): 0x" & Hex(.bmBits)
    End With
End Function
'***

Quote:
> and some other stuff, like with the
> Device-Context, which feels like I'm busy making a detour around the
world,
> when all I seek to do is to get my hands on on the icon-data of the
> just-extracted icon ...

Once you have the Bitmap handles you can use GetBitmapBits() to extract the
raw data directly from the image into a VB Byte array, mess around with the
data then blast it all back with SetBitmapBits().  Alternatively if you
don't feel comfortable writing bit-depth independent code (The screen could
be running at any number of different bit-depths) then you can select the
Bitmap's temporarily into DC's, then use the GetDIBits() call to extract the
data in a device independent form.  Similarly SetDIBits() will push the data
back again when you're done editing it but be careful on palette'd displays,
this technique often results in odd effects due to the GDI's odd way of
colour re-mapping.

Quote:
> Well, that part I've allready nailed-down.  With aid of exactly the site
> you're suggesting I've retrieved the description of how the icon-file
should
> look like. I'm able to, by way of a very crude re-assembly of an on-screen
> Icon (in an image-box)  (scanning it pixel-by-pixel to re-create the
> Color-table for example) to generate a (somewhat) acceptable icon-file.
So,
> it should not be a problem (anymore :-)

Here's an example of the above methods it will extract the icon information,
invert the data, reset the data and draw it:

'***
Private Declare Function GetIconInfo Lib "user32" _
    (ByVal hIcon As Long, ByRef piconinfo As IconInfo) As Long

Private Declare Function GetObject Lib "gdi32" Alias _
    "GetObjectA" (ByVal hObject As Long, _
    ByVal nCount As Long, ByRef lpObject As Any) As Long

Private Declare Function DeleteObject Lib "gdi32" _
    (ByVal hObject As Long) As Long

Private Declare Function DestroyIcon Lib "user32" _
    (ByVal hIcon As Long) As Long

Private Declare Function CreateCompatibleDC Lib _
    "gdi32" (ByVal hdc As Long) As Long

Private Declare Function SelectObject Lib "gdi32" _
    (ByVal hdc As Long, ByVal hObject As Long) As Long

Private Declare Function GetDIBits Lib "gdi32" _
    (ByVal aHDC As Long, ByVal hBitmap As Long, _
    ByVal nStartScan As Long, ByVal nNumScans As Long, _
    ByRef lpBits As Any, ByRef lpBI As BITMAPINFOHEADER, _
    ByVal wUsage As Long) As Long

Private Declare Function SetDIBits Lib "gdi32" _
    (ByVal hdc As Long, ByVal hBitmap As Long, _
    ByVal nStartScan As Long, ByVal nNumScans As Long, _
    ByRef lpBits As Any, ByRef lpBI As BITMAPINFOHEADER, _
    ByVal wUsage As Long) As Long

Private Declare Function SetTextColor Lib "gdi32" _
    (ByVal hdc As Long, ByVal crColor As Long) As Long

Private Declare Function SetBkColor Lib "gdi32" _
    (ByVal hdc As Long, ByVal crColor As Long) As Long

Private Declare Function BitBlt Lib "gdi32" _
    (ByVal hDestDC As Long, ByVal x As Long, _
    ByVal y As Long, ByVal nWidth As Long, _
    ByVal nHeight As Long, ByVal hSrcDC As Long, _
    ByVal xSrc As Long, ByVal ySrc As Long, _
    ByVal dwRop As Long) As Long

Private Declare Function DeleteDC Lib "gdi32" _
    (ByVal hdc As Long) As Long

Private Type IconInfo
    fIcon As Long
    xHotspot As Long
    yHotspot As Long
    hbmMask As Long
    hbmColor As Long
End Type

Private Type Bitmap ' 14 bytes
    bmType As Long
    bmWidth As Long
    bmHeight As Long
    bmWidthBytes As Long
    bmPlanes As Integer
    bmBitsPixel As Integer
    bmBits As Long
End Type

Private Type BITMAPINFOHEADER '40 bytes
    biSize As Long
    biWidth As Long
    biHeight As Long
    biPlanes As Integer
    biBitCount As Integer
    biCompression As Long
    biSizeImage As Long
    biXPel{*filter*}eter As Long
    biYPel{*filter*}eter As Long
    biClrUsed As Long
    biClrImportant As Long
End Type

Private Function DrawInvIcon(ByVal outDC As Long, _
    ByVal outX As Long, ByVal outY As Long, _
    ByVal inIcon As Long) As Boolean
    Dim IconInf As IconInfo
    Dim MaskBMInf As Bitmap
    Dim ColourBMInf As Bitmap
    Dim MyDC As Long, OldBMP As Long
    Dim BMData() As Byte
    Dim BMInf As BITMAPINFOHEADER
    Dim LoopData As Long
    Dim MaskDC As Long, OldMask As Long
    Dim OldFore As Long, OldBack As Long

    ' Check the icon exists
    If (inIcon = 0) Then Exit Function

    ' Grab the icon information
    If (GetIconInfo(inIcon, IconInf) = 0) Then Exit Function

    ' Grab the Bitmap information
    Call GetObject(IconInf.hbmMask, _
        Len(MaskBMInf), MaskBMInf)
    Call GetObject(IconInf.hbmColor, _
        Len(ColourBMInf), ColourBMInf)

    ' Create temporary device context
    MyDC = CreateCompatibleDC(0)

    ' Select Colour part of icon into DC
    OldBMP = SelectObject(MyDC, IconInf.hbmColor)

    If (OldBMP) Then ' Set bitmap information
        With BMInf
            .biWidth = ColourBMInf.bmWidth
            .biHeight = ColourBMInf.bmHeight
            .biBitCount = 32
            .biPlanes = 1
            .biSize = Len(BMInf)
            .biSizeImage = ( _
                ColourBMInf.bmWidthBytes * _
                ColourBMInf.bmHeight)

            ' Size data array
            ReDim BMData(.biSizeImage - 1) As Byte
        End With

        ' Grab Bitmap data from the colour Bitmap
        If (GetDIBits(MyDC, IconInf.hbmColor, 0, _
            ColourBMInf.bmHeight, BMData(0), BMInf, 0)) Then

            ' Invert Bitmap data
            For LoopData = 0 To BMInf.biSizeImage - 1
                BMData(LoopData) = BMData(LoopData) Xor &HFF
            Next LoopData

            ' Push edited data back into the colour Bitmap
            Call SetDIBits(MyDC, IconInf.hbmColor, 0, _
                ColourBMInf.bmHeight, BMData(0), BMInf, 0)
        End If

        ' Create new DC, select mask Bitmap into it
        MaskDC = CreateCompatibleDC(0)
        OldMask = SelectObject(MaskDC, IconInf.hbmMask)

        ' Set the fore and back colours in preperation
        '   to draw the mask onto the colour data
        Call SetTextColor(MyDC, vbWhite)
        Call SetBkColor(MyDC, vbBlack)

        ' Overlay mask image onto colour image
        '   (The masked area's must be black,
        '    we've just inverted them to white)
        Call BitBlt(MyDC, 0, 0, BMInf.biWidth, _
            BMInf.biHeight, MaskDC, 0, 0, vbSrcAnd)

        ' Set the fore and back colours of the
        '   destination canvas to draw mask
        OldFore = SetTextColor(outDC, vbWhite)
        OldBack = SetTextColor(outDC, vbBlack)

        ' Draw the mask to the destination DC
        Call BitBlt(outDC, outX, outY, BMInf.biWidth, _
            BMInf.biHeight, MaskDC, 0, 0, vbSrcAnd)

        ' Overlay the colour data
        Call BitBlt(outDC, outX, outY, BMInf.biWidth,
...

read more »



Thu, 30 Jun 2005 06:40:01 GMT  
 Icons - How to gain access to the Mask, image as well as the Color-table : ExtractIcon



Hello Mike,

Quote:
> > Yes, I've seen that call before.  It returns two handles,
> > one to the BitMask data, and one to the Color-data.
> > But after that I'm again stuck ....
> > For some reason I than have to do/should be doing a
> > number of things, like retrieving (?) the icon's bitmap
> > -header (that does not want to match with the Icon I
> > just loaded :-(  )

> Yes, the Bitmap's returned by ExtractIcon() are Device
> Dependant Bitmap's and as such bound to screen
> resolution (Or always 1-bpp in the case of the mask).

Ackkk !  That means I should at least show a warning when extracting many
color icons on low color screens (for example : 256 color icons on a 16
color screen) ....   That is, if I can check what the origional color-depth
of the extracted icon is :-)

Quote:
>  Here's an example of how to use the function to retrieve
> the information if you or anyone else needs it:

[Snip]

May I thank you for your example.  Now all I have to do is to see if I can
grasp what all the conversion-steps do. :-\

Quote:
> > and some other stuff, like with the Device-Context,
> > which feels like I'm busy making a detour around the
> > world, when all I seek to do is to get my hands on
> > on the icon-data of the just-extracted icon ...

> Once you have the Bitmap handles you can use
> GetBitmapBits() to extract the raw data directly from
> the image into a VB Byte array, mess around with the
> data then blast it all back with SetBitmapBits().
> Alternatively if you don't feel comfortable writing
> bit-depth independent code (The screen could be
> running at any number of different bit-depths) then you
> can select the Bitmap's temporarily into DC's, then use
> the GetDIBits() call to extract the data in a device
> independent form.  Similarly SetDIBits() will push the
> data back again when you're done editing it but be
> careful on palette'd displays, this technique often results
> in odd effects due to the GDI's odd way of colour
> re-mapping.

Hmm ...  That would twart my intention, extracting the Icon form a resource,
and save it as it was present in that resource (or at last having the chance
to alter that origional recource, not it's (downgraded ?) representation of
it ...)

Quote:
> > Well, that part I've allready nailed-down.  With aid
> > of exactly the site you're suggesting I've retrieved the
> > description of how the icon-file should look like. I'm
> > able to, by way of a very crude re-assembly of an
> > on-screen Icon (in an image-box)  (scanning it pixel
> > -by-pixel to re-create the Color-table for example)
> > to generate a (somewhat) acceptable icon-file.
> > So, it should not be a problem (anymore :-)

> Here's an example of the above methods it will extract
> the icon information, invert the data, reset the data and
> draw it:

[Snip]

Quote:
> Hope this helps,

I'm sure am going to try it out.  All of it.

Thank you for your help.

Regards,
  Rudy Wieser



Thu, 30 Jun 2005 18:39:50 GMT  
 Icons - How to gain access to the Mask, image as well as the Color-table : ExtractIcon

Quote:
> Ackkk !  That means I should at least show a warning when extracting many
> color icons on low color screens (for example : 256 color icons on a 16
> color screen) ....

GDI will mangle the above example no matter what you do, that's why an icon
is _supposed_ to have multiple version with the colour dithering already in
place rather than relying on the system.
By having the icon's at screen resolution, it makes your job far easier
(Ever tried re-mapping and dithering colours to an existing palette?).  The
number of users still running low-colour displays is not very many though
and of those, most will be running at 8-bit which usually makes a fair job
at converting the true colour icons (I.e. you can still usually see what's
trying to be depicted)

Quote:
> That is, if I can check what the origional color-depth
> of the extracted icon is :-)

Why do you need it?  Unless you're writing the icon back to the file (Which
takes a lot more work) then you'll only be working as screen resolution?

Quote:
> May I thank you for your example.  Now all I have to do is to see if I can
> grasp what all the conversion-steps do. :-\

ExtractIcon() simply retrieves the icon resource from the file we send it
and loads it into an Icon object which we are responsible for destroying
when done with it:
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterf...

GetIconInfo() retrieves the internal information about the Icon it's given,
including two Bitmap objects which are copies of the colour and mask data
for that Icon - Remember though that these are only copies, they must be
destroyed when we no longer need them:
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterf...

GetObject() retrieves the information about GDI objects, in this case though
we use it to read the Bitmap header off a Bitmap object:
http://msdn.microsoft.com/library/en-us/gdi/devcons_912s.asp

DeleteObject() destroys a GDI object, in this case the Bitmaps:
http://msdn.microsoft.com/library/en-us/gdi/devcons_1vsk.asp

DestroyIcon() destroys an Icon resource:
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterf...

Quote:
> Hmm ...  That would twart my intention, extracting the Icon form a
resource,
> and save it as it was present in that resource (or at last having the
chance
> to alter that origional recource, not it's (downgraded ?) representation
of
> it ...)

In that case ExtractIcon() isn't what you want, it's responsible for
returning you the DDB.  I'm not sure if there's anything else about that
will parse the resources from an .EXE but you could have a hunt around for
them.  Otherwise you'll have to learn the structure of an .EXE or .DLL and
extract the icons as Binary data manually (Or you could attempt to fudge it
by looking for common traits of icons within the file, very messy though..)
Hope this helps,

    Mike

 -- EDais --

 - Microsoft Visual Basic MVP -
WWW: Http://EDais.earlsoft.co.uk/




Thu, 30 Jun 2005 20:31:40 GMT  
 Icons - How to gain access to the Mask, image as well as the Color-table : ExtractIcon


Hello Mike,

Quote:
> > Ackkk !  That means I should at least show a warning
> > when extracting many color icons on low color screens
> > (for example : 256 color icons on a 16 color screen) ....

> GDI will mangle the above example no matter what you do,
> that's why an icon is _supposed_ to have multiple version
> with the colour dithering already in place rather than relying
> on the system.

I thought those where present to be able to use the icon most equal to the
current screen-settings (after which they could be mangeled in the best
representation for the current screen), but that you could choose to load
any-and-all of those icons, even ones with other dimensions & color-depths.

Somewhere I remember having seen the possibility to extract the "small" and
"large" icon's from resources, but I would have to check my notes for
specifics on that one ...

Quote:
> By having the icon's at screen resolution, it makes your job far easier
> (Ever tried re-mapping and dithering colours to an existing palette?).
The
> number of users still running low-colour displays is not very many though
> and of those, most will be running at 8-bit which usually makes a fair job
> at converting the true colour icons (I.e. you can still usually see what's
> trying to be depicted)

> > That is, if I can check what the origional color-depth
> > of the extracted icon is :-)

> Why do you need it?  Unless you're writing the icon back to the file
(Which
> takes a lot more work) then you'll only be working as screen resolution?

Well, the actual writing of an Icon-file is not that difficult (if you have
the specs to how the file is build).

The problem that I seem to have is that I'm not permitted to access/extract
the actual raw icon-data from a resource.

Quote:
> > May I thank you for your example.  Now all I have to do is to see if I
can
> > grasp what all the conversion-steps do. :-\

[List of references snipped]

Thanks for the list of references to the different call's.  Especially the
mentioning the "DeleteObject" -call.   I did not read in *MS*-es own
explanation of the call that you should destroy the returned handles after
you're done with them :-(    Although, I could have known, I've had the same
problem with ExtractIcon.

Quote:
> > Hmm ...  That would twart my intention, extracting the
> > Icon form a resource, and save it as it was present in
> > that resource (or at last having the chance to alter that
> > origional recource, not it's (downgraded ?) representation
> > of it ...)

> In that case ExtractIcon() isn't what you want, it's responsible for
> returning you the DDB.

Yes, I'm coming to that conclusion too :-(  I thought the ExtractIcon would
do just that, and load it's information raw, or at the most into DIB's.
Alas, It's not so.

Quote:
> I'm not sure if there's anything else about that
> will parse the resources from an .EXE but you could have a hunt around for
> them.  Otherwise you'll have to learn the structure of an .EXE or .DLL and
> extract the icons as Binary data manually (Or you could attempt to fudge
it
> by looking for common traits of icons within the file, very messy

though..)

It looks like that your above description is exactly the way I have to go.
I hoped I did not have to do that, and could use more general means
(system-own methods, therefore usable on, I hoped, multiple
Windows-versions) to get the work done.

Quote:
> Hope this helps,

It sure does.   You allready set me straight on the DDB v.s. DIB loading of
Icon-data, which is so fundamental that I have to re-think my strategy.
The other things you mentioned where not said to deaf ears too, so yes, you
can say you helped :-)

Regards,
  Rudy Wieser



Thu, 30 Jun 2005 21:33:19 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Icons - How to gain access to the Mask, image as well as the Color-table : ExtractIcon

2. Image Control with Mask Color

3. Gray Mask Color in Image List

4. TabStrip Control Images Do Not Use Mask Color

5. TabControl Images Do Not Use Mask Color

6. Mask Color For an Image Control

7. Extra constaint name occure in SQL Server if upsize table from access

8. A problem when VB5.0's picture box reads a CMYK color-tabled image

9. How do I mask an image in VB4 to get rid of my image borders

10. Best way to access Oracle tables

11. Best way to access FoxPro 2.6 tables

12. why cant i gain access to Outlook?

 

 
Powered by phpBB® Forum Software