473,383 Members | 1,837 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Exctracting an icon from an EXE

Hello,
I have an EXE (.NET assembly) file with an icon which has 8 formats
(128x128, 96x961, ..., 24x24 and 16x16). I would like the extract the
128x128 sized icon only to display it on a PictureBox control.

I made some searchs and discovered that the Icon.ExtractAssociatedIcon()
function can do what I want, but only for the smallest icon size, ie 16x16
here... I tried Assembly.GetManifestResourceStream() also but I didn't
either find a way to extract the specified size.

Is there a way to extract that 128x128 sized icon that I missed, even
with Windows API ?
Thanks for any help :)
May 24 '07 #1
6 3892
Yes there is a shell32 API:
ExtractIcon() check MSDN online
But also there is a ICON class in the System.Drawing namespace that wraps
this for you.

Mike.
"Laurent Navarro" <yo*@yop.comwrote in message
news:eX*************@TK2MSFTNGP06.phx.gbl...
Hello,
I have an EXE (.NET assembly) file with an icon which has 8 formats
(128x128, 96x961, ..., 24x24 and 16x16). I would like the extract the
128x128 sized icon only to display it on a PictureBox control.

I made some searchs and discovered that the
Icon.ExtractAssociatedIcon() function can do what I want, but only for the
smallest icon size, ie 16x16 here... I tried
Assembly.GetManifestResourceStream() also but I didn't either find a way
to extract the specified size.

Is there a way to extract that 128x128 sized icon that I missed, even
with Windows API ?
Thanks for any help :)

May 24 '07 #2
Mike,
Thanks for your answer. The ExtractAssociatedIcon() function I
mentionned is a method of the System.Drawing.Icon class... but I didn't see
any way to extract a specified icon size. Maybe will I be luckier with the
ExtractIcon() function... I'll dig deeper.

Laurent
"Mike Spike" <Mi**@melted-Cpu-co.uka écrit dans le message de news:
%2****************@TK2MSFTNGP04.phx.gbl...
Yes there is a shell32 API:
ExtractIcon() check MSDN online
But also there is a ICON class in the System.Drawing namespace that wraps
this for you.

Mike.
"Laurent Navarro" <yo*@yop.comwrote in message
news:eX*************@TK2MSFTNGP06.phx.gbl...
> Hello,
I have an EXE (.NET assembly) file with an icon which has 8 formats
(128x128, 96x961, ..., 24x24 and 16x16). I would like the extract the
128x128 sized icon only to display it on a PictureBox control.

I made some searchs and discovered that the
Icon.ExtractAssociatedIcon() function can do what I want, but only for
the smallest icon size, ie 16x16 here... I tried
Assembly.GetManifestResourceStream() also but I didn't either find a way
to extract the specified size.

Is there a way to extract that 128x128 sized icon that I missed, even
with Windows API ?
Thanks for any help :)


May 24 '07 #3
Ah, yeah, you can specify the size in the actual Windows API call, this is
yet another example of microsoft wrapping an API call in class and then not
exposing the usefull parameters.

: 0 (

You do this by specifying a Parmeter and leaving another blank.

like: GetIcon(exename, handle, 0, 1)

where the 3rd parameter is for getting the small icon and the 4th is for
getting the large one and visa versa etc.

Mile

"Laurent Navarro" <yo*@yop.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Mike,
Thanks for your answer. The ExtractAssociatedIcon() function I
mentionned is a method of the System.Drawing.Icon class... but I didn't
see any way to extract a specified icon size. Maybe will I be luckier with
the ExtractIcon() function... I'll dig deeper.

Laurent
"Mike Spike" <Mi**@melted-Cpu-co.uka écrit dans le message de news:
%2****************@TK2MSFTNGP04.phx.gbl...
>Yes there is a shell32 API:
ExtractIcon() check MSDN online
But also there is a ICON class in the System.Drawing namespace that wraps
this for you.

Mike.
"Laurent Navarro" <yo*@yop.comwrote in message
news:eX*************@TK2MSFTNGP06.phx.gbl...
>> Hello,
I have an EXE (.NET assembly) file with an icon which has 8 formats
(128x128, 96x961, ..., 24x24 and 16x16). I would like the extract the
128x128 sized icon only to display it on a PictureBox control.

I made some searchs and discovered that the
Icon.ExtractAssociatedIcon() function can do what I want, but only for
the smallest icon size, ie 16x16 here... I tried
Assembly.GetManifestResourceStream() also but I didn't either find a way
to extract the specified size.

Is there a way to extract that 128x128 sized icon that I missed, even
with Windows API ?
Thanks for any help :)



May 24 '07 #4
Hi Mike,
I tried the ExtractIcon() and ExtractIconEx() functions. On the second
one, I have the parameters you said which can be used to select a small size
or a large size... But when I select the small size, I get the 16x16 icon,
and when I select the large size I get the 32x32... What I would like to get
is the 128x128 icon...

Is that possible ?

Thanks

Laurent

"Mike Spike" <Mi**@melted-Cpu-co.uka écrit dans le message de news:
u1**************@TK2MSFTNGP04.phx.gbl...
Ah, yeah, you can specify the size in the actual Windows API call, this is
yet another example of microsoft wrapping an API call in class and then
not exposing the usefull parameters.

: 0 (

You do this by specifying a Parmeter and leaving another blank.

like: GetIcon(exename, handle, 0, 1)

where the 3rd parameter is for getting the small icon and the 4th is for
getting the large one and visa versa etc.

Mile

"Laurent Navarro" <yo*@yop.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
> Mike,
Thanks for your answer. The ExtractAssociatedIcon() function I
mentionned is a method of the System.Drawing.Icon class... but I didn't
see any way to extract a specified icon size. Maybe will I be luckier
with the ExtractIcon() function... I'll dig deeper.

Laurent
"Mike Spike" <Mi**@melted-Cpu-co.uka écrit dans le message de news:
%2****************@TK2MSFTNGP04.phx.gbl...
>>Yes there is a shell32 API:
ExtractIcon() check MSDN online
But also there is a ICON class in the System.Drawing namespace that
wraps this for you.

Mike.
"Laurent Navarro" <yo*@yop.comwrote in message
news:eX*************@TK2MSFTNGP06.phx.gbl...
Hello,
I have an EXE (.NET assembly) file with an icon which has 8 formats
(128x128, 96x961, ..., 24x24 and 16x16). I would like the extract the
128x128 sized icon only to display it on a PictureBox control.

I made some searchs and discovered that the
Icon.ExtractAssociatedIcon() function can do what I want, but only for
the smallest icon size, ie 16x16 here... I tried
Assembly.GetManifestResourceStream() also but I didn't either find a
way to extract the specified size.

Is there a way to extract that 128x128 sized icon that I missed,
even with Windows API ?
Thanks for any help :)



May 24 '07 #5
It must be possible, I have looked at Shell32.dll and can not see a newer
function for this.

Mabye download a trial of an Icon Extraction program and open it with
"DEPENDS.EXE" from microsoft it will show you all the functions the EXE
image is linking to.

Regards,
Mike.

"Laurent Navarro" <yo*@yop.comwrote in message
news:O9**************@TK2MSFTNGP02.phx.gbl...
Hi Mike,
I tried the ExtractIcon() and ExtractIconEx() functions. On the second
one, I have the parameters you said which can be used to select a small
size or a large size... But when I select the small size, I get the 16x16
icon, and when I select the large size I get the 32x32... What I would
like to get is the 128x128 icon...

Is that possible ?

Thanks

Laurent

"Mike Spike" <Mi**@melted-Cpu-co.uka écrit dans le message de news:
u1**************@TK2MSFTNGP04.phx.gbl...
>Ah, yeah, you can specify the size in the actual Windows API call, this
is yet another example of microsoft wrapping an API call in class and
then not exposing the usefull parameters.

: 0 (

You do this by specifying a Parmeter and leaving another blank.

like: GetIcon(exename, handle, 0, 1)

where the 3rd parameter is for getting the small icon and the 4th is for
getting the large one and visa versa etc.

Mile

"Laurent Navarro" <yo*@yop.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>> Mike,
Thanks for your answer. The ExtractAssociatedIcon() function I
mentionned is a method of the System.Drawing.Icon class... but I didn't
see any way to extract a specified icon size. Maybe will I be luckier
with the ExtractIcon() function... I'll dig deeper.

Laurent
"Mike Spike" <Mi**@melted-Cpu-co.uka écrit dans le message de news:
%2****************@TK2MSFTNGP04.phx.gbl...
Yes there is a shell32 API:
ExtractIcon() check MSDN online
But also there is a ICON class in the System.Drawing namespace that
wraps this for you.

Mike.
"Laurent Navarro" <yo*@yop.comwrote in message
news:eX*************@TK2MSFTNGP06.phx.gbl...
Hello,
>
>
I have an EXE (.NET assembly) file with an icon which has 8 formats
(128x128, 96x961, ..., 24x24 and 16x16). I would like the extract the
128x128 sized icon only to display it on a PictureBox control.
>
I made some searchs and discovered that the
Icon.ExtractAssociatedIcon() function can do what I want, but only for
the smallest icon size, ie 16x16 here... I tried
Assembly.GetManifestResourceStream() also but I didn't either find a
way to extract the specified size.
>
Is there a way to extract that 128x128 sized icon that I missed,
even with Windows API ?
>
>
Thanks for any help :)
>




May 24 '07 #6
Hi Mike,
I finally found what I was looking for. There is a function named
PrivateExtractIcon() located in User32.dll that can extract a specified icon
size...

The documentation of this function is located at
http://msdn2.microsoft.com/en-us/library/ms648075.aspx and the wrapper is
easy to create.

Thanks for your help anyway !
Laurent

"Michael M." <no****@mike.coma écrit dans le message de news:
%2****************@TK2MSFTNGP04.phx.gbl...
It must be possible, I have looked at Shell32.dll and can not see a newer
function for this.

Mabye download a trial of an Icon Extraction program and open it with
"DEPENDS.EXE" from microsoft it will show you all the functions the EXE
image is linking to.

Regards,
Mike.

"Laurent Navarro" <yo*@yop.comwrote in message
news:O9**************@TK2MSFTNGP02.phx.gbl...
> Hi Mike,
I tried the ExtractIcon() and ExtractIconEx() functions. On the second
one, I have the parameters you said which can be used to select a small
size or a large size... But when I select the small size, I get the 16x16
icon, and when I select the large size I get the 32x32... What I would
like to get is the 128x128 icon...

Is that possible ?

Thanks

Laurent

"Mike Spike" <Mi**@melted-Cpu-co.uka écrit dans le message de news:
u1**************@TK2MSFTNGP04.phx.gbl...
>>Ah, yeah, you can specify the size in the actual Windows API call, this
is yet another example of microsoft wrapping an API call in class and
then not exposing the usefull parameters.

: 0 (

You do this by specifying a Parmeter and leaving another blank.

like: GetIcon(exename, handle, 0, 1)

where the 3rd parameter is for getting the small icon and the 4th is for
getting the large one and visa versa etc.

Mile

"Laurent Navarro" <yo*@yop.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl.. .
Mike,
Thanks for your answer. The ExtractAssociatedIcon() function I
mentionned is a method of the System.Drawing.Icon class... but I didn't
see any way to extract a specified icon size. Maybe will I be luckier
with the ExtractIcon() function... I'll dig deeper.

Laurent
"Mike Spike" <Mi**@melted-Cpu-co.uka écrit dans le message de news:
%2****************@TK2MSFTNGP04.phx.gbl...
Yes there is a shell32 API:
ExtractIcon() check MSDN online
But also there is a ICON class in the System.Drawing namespace that
wraps this for you.
>
Mike.
>
>
"Laurent Navarro" <yo*@yop.comwrote in message
news:eX*************@TK2MSFTNGP06.phx.gbl...
> Hello,
>>
>>
> I have an EXE (.NET assembly) file with an icon which has 8
>formats (128x128, 96x961, ..., 24x24 and 16x16). I would like the
>extract the 128x128 sized icon only to display it on a PictureBox
>control.
>>
> I made some searchs and discovered that the
>Icon.ExtractAssociatedIcon() function can do what I want, but only
>for the smallest icon size, ie 16x16 here... I tried
>Assembly.GetManifestResourceStream() also but I didn't either find a
>way to extract the specified size.
>>
> Is there a way to extract that 128x128 sized icon that I missed,
>even with Windows API ?
>>
>>
> Thanks for any help :)
>>
>
>




May 25 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Vic | last post by:
I am trying to change an icon associated with my application's main form and the application itself. 1. I selected my main form in IDE "Solution" tab and went to "Properties" window. 2. I found...
4
by: Terry | last post by:
There are a number of things about using unmanaged resources in Windows Forms programming that is unclear to me. In C++, if you loaded an icon resource using "ExtractIcon()", the resource was...
8
by: Adrian | last post by:
How do I put an icon on a form using code? Thank you.
2
by: Dickyb | last post by:
Extracting an Icon and Placing It On The Desktop (C# Language) I constructed a suite of programs in C++ several years ago that handle my financial portfolio, and now I have converted them to...
14
by: Kishan Hathiwala | last post by:
Hi i have kept a statusbar in the form with panels = true. and total there 3 panels. whenever i click on the 3rd panel a menu appears showing online and offline and either is enable at a time....
0
by: kapcreations | last post by:
I have a system tray app which gets the status of a windows service, and displays the appropriate icon for the status of the service in the systray. the problem I am having is the icon disapears...
5
by: IcingDeath via DotNetMonster.com | last post by:
I am building this SQL Server database app in which i can store files. In order to display files I want to have the app show the associated icon for the extension of the file that is in the...
3
by: Nina | last post by:
Hi there, I assigned icon for a window's form using form's Icon property at design time. Now I want to change the icon. I tried to replace the old icon with the new icon using form's Icon...
4
by: randy1200 | last post by:
I have a Windows application that previously had the company logo "MyCompany.ico" added to the upper left-most corner. The company has since issued a new version of "MyCompany.ico" that looks...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.