🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages Started by FEEX Wed, 07 Feb 2007 17:58
Problem with ExtractIcon in BDS2006
#2628
Author: FEEX
Date: Wed, 07 Feb 2007 17:58
20 lines
1551 bytes
I created an executable (SFX) file with an icon 32 x 32 and 16 colors.

In BCB5 and BCB6 when i extracted the icon from that file with
  HICON hico = ExtractIcon(HInstance, File.c_str(), 0);
I got the original icon size is 766 bytes

Now when I do the same using TurboC++ 2006 I receive an icon 32 x 32 but 
with 2^32 colors. size is 4KB

Is there anything we can do to extract the icon from this ( or any other 
file) with its original size and color dept?
Or has somebody a function to replace an icon by another one with 
different size that can/will work all windows version
(ReplaceResource only works in NT based systems)


-- 
Roger Aelbrecht
www.drehoeksw.net
www.bcbzip.net
Re: Problem with ExtractIcon in BDS2006
#2537
Author: Mike Collins
Date: Mon, 12 Feb 2007 12:35
35 lines
2281 bytes
Hay Feex....

Can you explain exactly what you are trying to do - i'm a bit confused by 
what you are trying to achieve as your end goal.  I've messed on loads with 
icons and other images under windows and then winXP - there are some key 
issues with some of the api's and in my personal opinion, the way builder 
creates its resources.

Perhaps i can provide some details if you can clarify what you are trying to 
do - i might be totally braking up the wrong tree though.

Mike

"FEEX" <feex@drehoek.net> wrote in message 
news:45ca135e@newsgroups.borland.com...
>I created an executable (SFX) file with an icon 32 x 32 and 16 colors.
>
> In BCB5 and BCB6 when i extracted the icon from that file with
>  HICON hico = ExtractIcon(HInstance, File.c_str(), 0);
> I got the original icon size is 766 bytes
>
> Now when I do the same using TurboC++ 2006 I receive an icon 32 x 32 but 
> with 2^32 colors. size is 4KB
>
> Is there anything we can do to extract the icon from this ( or any other 
> file) with its original size and color dept?
> Or has somebody a function to replace an icon by another one with 
> different size that can/will work all windows version
> (ReplaceResource only works in NT based systems)
>
>
> -- 
> Roger Aelbrecht
> www.drehoeksw.net
> www.bcbzip.net 
Re: Problem with ExtractIcon in BDS2006
#2541
Author: FEEX
Date: Mon, 12 Feb 2007 14:48
38 lines
2458 bytes
Mike Collins wrote:
> Hay Feex....
> 
> Can you explain exactly what you are trying to do - i'm a bit confused by 
> what you are trying to achieve as your end goal.  I've messed on loads with 
> icons and other images under windows and then winXP - there are some key 
> issues with some of the api's and in my personal opinion, the way builder 
> creates its resources.
> 
> Perhaps i can provide some details if you can clarify what you are trying to 
> do - i might be totally braking up the wrong tree though.
> 
> Mike
> 

What we try to do is replace the existing icon in an SFX(EXE) file with 
another one of the same size. hat method worked well until BDS4 was used.

Meanwhile we found out (Russell Peters did) what caused all the trouble.
When the TIcon used its SaveToSteam method it uses the WriteIcon method( 
in Graphics.pas)
In previous BCB/Delphi versions this method was called with a 'Color' 
parameter = 4 resulting in a 16 color icon (if it was created that way)
BDS4 calls that method with a 'Color" value of -1 resulting in a icon 
with 64K colors.

As a solution we will write our own version of WriteIcon that will 
extract the icon with the desired 16 color version for further use.

I have done a number of tests with the UpdateResource API functions but 
the resulting EXE did not load anymore. I suppose because the EXE was 
compressed using the UPX tool.


-- 
Roger Aelbrecht
www.drehoeksw.net
www.bcbzip.net
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads