473,725 Members | 2,276 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Extract Icon

Hi
I am looking for a way to extraxt an icon from a .exe file an save it as an
icon not a bitmap or jpeg to a file?

The code below extracts the icon but only as a bitmap

PictureBox1.Ima ge =
Drawing.Icon.Ex tractAssociated Icon("file.exe" ).ToBitmap

The problem is I need the icon not the bitmap.
Thanks
Sep 19 '08 #1
7 2342

Dim x As Integer = 1
'img is an imagelist
For Each ico As Image In img.Images
x = x + 1
pb1.Image = ico
Application.DoE vents()
ico.Save(apath & "icones\" & IO.Path.GetFile Name(fil) & x &
".ico", System.Drawing. Imaging.ImageFo rmat.Icon)
Next

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:6B******** *************** ***********@mic rosoft.com...
Hi
I am looking for a way to extraxt an icon from a .exe file an save it as
an
icon not a bitmap or jpeg to a file?

The code below extracts the icon but only as a bitmap

PictureBox1.Ima ge =
Drawing.Icon.Ex tractAssociated Icon("file.exe" ).ToBitmap

The problem is I need the icon not the bitmap.
Thanks
Sep 19 '08 #2
Hi Gillard

I know your code can work. but for some reason it is not working for me.
I added an imagelist
But what is "apath"
What is "fil"

When I ran your code, i used "c:\mydir" for "apath" and the path for
winword for "fil", I get a new page icon instead of the winword icon in the
folder.

Also for me to get anything at all I first had to run code to put the icon
into the imagelist and the picturebox
Here is the code I used to put the icon into the image list:

Private Sub Button4_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button4.Click
Dim ico As Icon = Icon.ExtractAss ociatedIcon(the path for
"winword.ex e")
ImageList1.Imag eSize = New Size(24, 24)
ImageList1.Imag es.Add(ico)

Dim theGraphics As Graphics = Graphics.FromHw nd(Me.Handle)

For count = 0 To ImageList1.Imag es.Count - 1

ImageList1.Draw (theGraphics, New Point(24, 24), count)

' Call Application.DoE vents to force a repaint of the form.
Application.DoE vents()

' Call the Sleep method to allow the user to see the image.
System.Threadin g.Thread.Sleep( 1000)
Next

I am sorry, but I think I need a some more help on this...please

"Gillard" wrote:
>
Dim x As Integer = 1
'img is an imagelist
For Each ico As Image In img.Images
x = x + 1
pb1.Image = ico
Application.DoE vents()
ico.Save(apath & "icones\" & IO.Path.GetFile Name(fil) & x &
".ico", System.Drawing. Imaging.ImageFo rmat.Icon)
Next

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:6B******** *************** ***********@mic rosoft.com...
Hi
I am looking for a way to extraxt an icon from a .exe file an save it as
an
icon not a bitmap or jpeg to a file?

The code below extracts the icon but only as a bitmap

PictureBox1.Ima ge =
Drawing.Icon.Ex tractAssociated Icon("file.exe" ).ToBitmap

The problem is I need the icon not the bitmap.
Thanks

Sep 20 '08 #3
Hi Gillard
The "Icon Ripper.Zip" attachment did not come thru. Can you resend it?

"Gillard" wrote:
>
here is the full version of the program as attachment " icon ripper.zip "

apath is a directory (drive \ directory)

fil is a filepath ( drive \ directory \ filename)

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:2B******** *************** ***********@mic rosoft.com...
Hi Gillard

I know your code can work. but for some reason it is not working for me.
I added an imagelist
But what is "apath"
What is "fil"

When I ran your code, i used "c:\mydir" for "apath" and the path for
winword for "fil", I get a new page icon instead of the winword icon in
the
folder.

Also for me to get anything at all I first had to run code to put the icon
into the imagelist and the picturebox
Here is the code I used to put the icon into the image list:

Private Sub Button4_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button4.Click
Dim ico As Icon = Icon.ExtractAss ociatedIcon(the path for
"winword.ex e")
ImageList1.Imag eSize = New Size(24, 24)
ImageList1.Imag es.Add(ico)

Dim theGraphics As Graphics = Graphics.FromHw nd(Me.Handle)

For count = 0 To ImageList1.Imag es.Count - 1

ImageList1.Draw (theGraphics, New Point(24, 24), count)

' Call Application.DoE vents to force a repaint of the form.
Application.DoE vents()

' Call the Sleep method to allow the user to see the image.
System.Threadin g.Thread.Sleep( 1000)
Next

I am sorry, but I think I need a some more help on this...please

"Gillard" wrote:
>
Dim x As Integer = 1
'img is an imagelist
For Each ico As Image In img.Images
x = x + 1
pb1.Image = ico
Application.DoE vents()
ico.Save(apath & "icones\" & IO.Path.GetFile Name(fil) & x &
".ico", System.Drawing. Imaging.ImageFo rmat.Icon)
Next

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:6B******** *************** ***********@mic rosoft.com...
Hi
I am looking for a way to extraxt an icon from a .exe file an save it
as
an
icon not a bitmap or jpeg to a file?

The code below extracts the icon but only as a bitmap

PictureBox1.Ima ge =
Drawing.Icon.Ex tractAssociated Icon("file.exe" ).ToBitmap

The problem is I need the icon not the bitmap.
Thanks

Sep 20 '08 #4
Hi there
Sorry to say, but for some reason I still have not seen the attachment, and
it is something I really need to take a look at.
I think it maybe bacause I was using IE 8.2 Beta. I am back to using IE 7.0
now. So, I am asking that you resend the attachment one last time for me
please.
Thanks

"Gillard" wrote:
yes

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:E6******** *************** ***********@mic rosoft.com...
Hi Gillard
The "Icon Ripper.Zip" attachment did not come thru. Can you resend it?

"Gillard" wrote:
>
here is the full version of the program as attachment " icon
ripper.zip "

apath is a directory (drive \ directory)

fil is a filepath ( drive \ directory \ filename)

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:2B******** *************** ***********@mic rosoft.com...
Hi Gillard

I know your code can work. but for some reason it is not working for
me.
I added an imagelist
But what is "apath"
What is "fil"

When I ran your code, i used "c:\mydir" for "apath" and the path for
winword for "fil", I get a new page icon instead of the winword icon in
the
folder.

Also for me to get anything at all I first had to run code to put the
icon
into the imagelist and the picturebox
Here is the code I used to put the icon into the image list:

Private Sub Button4_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button4.Click
Dim ico As Icon = Icon.ExtractAss ociatedIcon(the path for
"winword.ex e")
ImageList1.Imag eSize = New Size(24, 24)
ImageList1.Imag es.Add(ico)

Dim theGraphics As Graphics = Graphics.FromHw nd(Me.Handle)

For count = 0 To ImageList1.Imag es.Count - 1

ImageList1.Draw (theGraphics, New Point(24, 24), count)

' Call Application.DoE vents to force a repaint of the form.
Application.DoE vents()

' Call the Sleep method to allow the user to see the image.
System.Threadin g.Thread.Sleep( 1000)
Next

I am sorry, but I think I need a some more help on this...please

"Gillard" wrote:


Dim x As Integer = 1
'img is an imagelist
For Each ico As Image In img.Images
x = x + 1
pb1.Image = ico
Application.DoE vents()
ico.Save(apath & "icones\" & IO.Path.GetFile Name(fil) & x
&
".ico", System.Drawing. Imaging.ImageFo rmat.Icon)
Next

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:6B******** *************** ***********@mic rosoft.com...
Hi
I am looking for a way to extraxt an icon from a .exe file an save
it
as
an
icon not a bitmap or jpeg to a file?

The code below extracts the icon but only as a bitmap

PictureBox1.Ima ge =
Drawing.Icon.Ex tractAssociated Icon("file.exe" ).ToBitmap

The problem is I need the icon not the bitmap.
Thanks

Sep 23 '08 #5
I wonder if some news servers do not allow attachments for this group? I
saw at least one of the earlier attachments. I use news.microsoft. com for
this newsgroup. It's free - so if that's not the server you use to see this
newsgroup I recommend that you try it.

Bob

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:2D******** *************** ***********@mic rosoft.com...
Hi there
Sorry to say, but for some reason I still have not seen the attachment,
and
it is something I really need to take a look at.
I think it maybe bacause I was using IE 8.2 Beta. I am back to using IE
7.0
now. So, I am asking that you resend the attachment one last time for me
please.
Thanks

"Gillard" wrote:
>yes

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:E6******* *************** ************@mi crosoft.com...
Hi Gillard
The "Icon Ripper.Zip" attachment did not come thru. Can you resend it?

"Gillard" wrote:
here is the full version of the program as attachment " icon
ripper.zip "

apath is a directory (drive \ directory)

fil is a filepath ( drive \ directory \ filename)

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:2B******* *************** ************@mi crosoft.com...
Hi Gillard

I know your code can work. but for some reason it is not working for
me.
I added an imagelist
But what is "apath"
What is "fil"

When I ran your code, i used "c:\mydir" for "apath" and the path
for
winword for "fil", I get a new page icon instead of the winword icon
in
the
folder.

Also for me to get anything at all I first had to run code to put
the
icon
into the imagelist and the picturebox
Here is the code I used to put the icon into the image list:

Private Sub Button4_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button4.Click
Dim ico As Icon = Icon.ExtractAss ociatedIcon(the path for
"winword.ex e")
ImageList1.Imag eSize = New Size(24, 24)
ImageList1.Imag es.Add(ico)

Dim theGraphics As Graphics = Graphics.FromHw nd(Me.Handle)

For count = 0 To ImageList1.Imag es.Count - 1

ImageList1.Draw (theGraphics, New Point(24, 24), count)

' Call Application.DoE vents to force a repaint of the
form.
Application.DoE vents()

' Call the Sleep method to allow the user to see the
image.
System.Threadin g.Thread.Sleep( 1000)
Next

I am sorry, but I think I need a some more help on this...please

"Gillard" wrote:
Dim x As Integer = 1
'img is an imagelist
For Each ico As Image In img.Images
x = x + 1
pb1.Image = ico
Application.DoE vents()
ico.Save(apath & "icones\" & IO.Path.GetFile Name(fil) &
x
&
".ico", System.Drawing. Imaging.ImageFo rmat.Icon)
Next

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:6B******* *************** ************@mi crosoft.com...
Hi
I am looking for a way to extraxt an icon from a .exe file an
save
it
as
an
icon not a bitmap or jpeg to a file?

The code below extracts the icon but only as a bitmap

PictureBox1.Ima ge =
Drawing.Icon.Ex tractAssociated Icon("file.exe" ).ToBitmap

The problem is I need the icon not the bitmap.
Thanks


Sep 24 '08 #6
Use a news reader exemple Windows Live Mail
protocol NNTP
port : 119
server: msnews.microsof t.com
the attachment is there

"eBob.com" <fa******@total lybogus.comwrot e in message
news:ud******** *****@TK2MSFTNG P04.phx.gbl...
I wonder if some news servers do not allow attachments for this group? I
saw at least one of the earlier attachments. I use news.microsoft. com for
this newsgroup. It's free - so if that's not the server you use to see
this newsgroup I recommend that you try it.

Bob

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:2D******** *************** ***********@mic rosoft.com...
>Hi there
Sorry to say, but for some reason I still have not seen the attachment,
and
it is something I really need to take a look at.
I think it maybe bacause I was using IE 8.2 Beta. I am back to using IE
7.0
now. So, I am asking that you resend the attachment one last time for me
please.
Thanks

"Gillard" wrote:
>>yes

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:E6****** *************** *************@m icrosoft.com...
Hi Gillard
The "Icon Ripper.Zip" attachment did not come thru. Can you resend it?

"Gillard" wrote:
here is the full version of the program as attachment " icon
ripper.zip "

apath is a directory (drive \ directory)

fil is a filepath ( drive \ directory \ filename)

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:2B****** *************** *************@m icrosoft.com...
Hi Gillard

I know your code can work. but for some reason it is not working
for
me.
I added an imagelist
But what is "apath"
What is "fil"

When I ran your code, i used "c:\mydir" for "apath" and the path
for
winword for "fil", I get a new page icon instead of the winword
icon in
the
folder.

Also for me to get anything at all I first had to run code to put
the
icon
into the imagelist and the picturebox
Here is the code I used to put the icon into the image list:

Private Sub Button4_Click(B yVal sender As System.Object, ByVal e As
System.EventAr gs) Handles Button4.Click
Dim ico As Icon = Icon.ExtractAss ociatedIcon(the path for
"winword.exe ")
ImageList1.Imag eSize = New Size(24, 24)
ImageList1.Imag es.Add(ico)

Dim theGraphics As Graphics = Graphics.FromHw nd(Me.Handle)

For count = 0 To ImageList1.Imag es.Count - 1

ImageList1.Draw (theGraphics, New Point(24, 24), count)

' Call Application.DoE vents to force a repaint of the
form.
Application.DoE vents()

' Call the Sleep method to allow the user to see the
image.
System.Threadin g.Thread.Sleep( 1000)
Next

I am sorry, but I think I need a some more help on this...please

"Gillard" wrote:
Dim x As Integer = 1
'img is an imagelist
For Each ico As Image In img.Images
x = x + 1
pb1.Image = ico
Application.DoE vents()
ico.Save(apath & "icones\" & IO.Path.GetFile Name(fil)
& x
&
".ico", System.Drawing. Imaging.ImageFo rmat.Icon)
Next

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:6B****** *************** *************@m icrosoft.com...
Hi
I am looking for a way to extraxt an icon from a .exe file an
save
it
as
an
icon not a bitmap or jpeg to a file?

The code below extracts the icon but only as a bitmap

PictureBox1.Ima ge =
Drawing.Icon.E xtractAssociate dIcon("file.exe ").ToBitmap

The problem is I need the icon not the bitmap.
Thanks


Sep 24 '08 #7
Thanks I got it

"Gillard" wrote:
Use a news reader exemple Windows Live Mail
protocol NNTP
port : 119
server: msnews.microsof t.com
the attachment is there

"eBob.com" <fa******@total lybogus.comwrot e in message
news:ud******** *****@TK2MSFTNG P04.phx.gbl...
I wonder if some news servers do not allow attachments for this group? I
saw at least one of the earlier attachments. I use news.microsoft. com for
this newsgroup. It's free - so if that's not the server you use to see
this newsgroup I recommend that you try it.

Bob

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:2D******** *************** ***********@mic rosoft.com...
Hi there
Sorry to say, but for some reason I still have not seen the attachment,
and
it is something I really need to take a look at.
I think it maybe bacause I was using IE 8.2 Beta. I am back to using IE
7.0
now. So, I am asking that you resend the attachment one last time for me
please.
Thanks

"Gillard" wrote:

yes

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:E6******* *************** ************@mi crosoft.com...
Hi Gillard
The "Icon Ripper.Zip" attachment did not come thru. Can you resend it?

"Gillard" wrote:
here is the full version of the program as attachment " icon
ripper.zip "

apath is a directory (drive \ directory)

fil is a filepath ( drive \ directory \ filename)

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:2B******* *************** ************@mi crosoft.com...
Hi Gillard

I know your code can work. but for some reason it is not working
for
me.
I added an imagelist
But what is "apath"
What is "fil"

When I ran your code, i used "c:\mydir" for "apath" and the path
for
winword for "fil", I get a new page icon instead of the winword
icon in
the
folder.

Also for me to get anything at all I first had to run code to put
the
icon
into the imagelist and the picturebox
Here is the code I used to put the icon into the image list:

Private Sub Button4_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button4.Click
Dim ico As Icon = Icon.ExtractAss ociatedIcon(the path for
"winword.ex e")
ImageList1.Imag eSize = New Size(24, 24)
ImageList1.Imag es.Add(ico)

Dim theGraphics As Graphics = Graphics.FromHw nd(Me.Handle)

For count = 0 To ImageList1.Imag es.Count - 1

ImageList1.Draw (theGraphics, New Point(24, 24), count)

' Call Application.DoE vents to force a repaint of the
form.
Application.DoE vents()

' Call the Sleep method to allow the user to see the
image.
System.Threadin g.Thread.Sleep( 1000)
Next

I am sorry, but I think I need a some more help on this...please

"Gillard" wrote:
Dim x As Integer = 1
'img is an imagelist
For Each ico As Image In img.Images
x = x + 1
pb1.Image = ico
Application.DoE vents()
ico.Save(apath & "icones\" & IO.Path.GetFile Name(fil)
& x
&
".ico", System.Drawing. Imaging.ImageFo rmat.Icon)
Next

"Ben" <Be*@discussion s.microsoft.com wrote in message
news:6B******* *************** ************@mi crosoft.com...
Hi
I am looking for a way to extraxt an icon from a .exe file an
save
it
as
an
icon not a bitmap or jpeg to a file?

The code below extracts the icon but only as a bitmap

PictureBox1.Ima ge =
Drawing.Icon.Ex tractAssociated Icon("file.exe" ).ToBitmap

The problem is I need the icon not the bitmap.
Thanks

Oct 4 '08 #8

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

Similar topics

4
8597
by: Mehdi Mousavi | last post by:
Hi, I need to know how to extract a specific icon (32x32 for instance) from an icon file that contains more than one icon size? Any help would be highly appreciated, Cheers. Mehdi
6
10509
by: Mohammad-Reza | last post by:
Hi I want to extract icon of an exe file and want to know how. I look at the MSDN and find out that I can use ExtractIconEx() Windows API but in there are some changes to that api in c# I made those changes like this : public static extern uint ExtractIconEx( string szFile,
2
1494
by: Steve | last post by:
How can I extract a icon from a exist program? for examle, notepad.exe.
2
2030
by: Dave | last post by:
Can anyone tell me how to extract the resources, specifically the description and icons, from a .EXE file programatically. Basically I want to write a C# application that takes .EXE files and displays their description and their icons, more or less like right-clicking the file in explorer and displaying properties. -- Dave
2
7319
by: Alexander VS | last post by:
Hello all! How can i exract an icon associated with a file? I found API function ExtractAssociatedIcon, but can i use this function with VB.Net? Can i do it easier with some .Net class? Thanks.
6
11003
by: Udi | last post by:
Hi, I have an imagelist initialized in design time with several icons files (.ico). However, when I need to extract an icon (Image) from the Imagelist, I can't convert it back to an icon: statusBarPanel1.Icon = imageList1.Images; // cast/as don't work // Cannot convert type 'System.Drawing.Image' to 'System.Drawing.Icon' What am I mising here?
0
1377
by: Frank | last post by:
If I have an icon file that contains one icon ExtractIconEx tells me there is one there. If the file contains 1 32x32 icon and one 16x16 icon ExtractIconEx still tells me there is one. I need to know how many icons of each size is in the file. I want to extract the icons as they exist in the file. That is, if there is a 17x17 and a 22x22 icon in the file I want to extract
2
1876
by: Spam Catcher | last post by:
Hi all, Does .NET provide any native API calls to extract .DLL/.EXE icon files based on IconIndex? Is there a way to enumerate through all the icons in an assembly (.NET or Native code assemblies)? Thanks!
0
2360
by: Sathyaish | last post by:
I want to get the icon from an IE shortcut (.url) file without passing a new WebRequest to the server. The .url is an INI file that has the path to the original URI where the icon file resides, but I don't want to make a new web request. Surely the file must be somewhere already on the local system. Is there a way to get it?
0
8889
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9116
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.