473,322 Members | 1,379 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,322 software developers and data experts.

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.Image =
Drawing.Icon.ExtractAssociatedIcon("file.exe").ToB itmap

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

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

"Ben" <Be*@discussions.microsoft.comwrote in message
news:6B**********************************@microsof t.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.Image =
Drawing.Icon.ExtractAssociatedIcon("file.exe").ToB itmap

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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Dim ico As Icon = Icon.ExtractAssociatedIcon(the path for
"winword.exe")
ImageList1.ImageSize = New Size(24, 24)
ImageList1.Images.Add(ico)

Dim theGraphics As Graphics = Graphics.FromHwnd(Me.Handle)

For count = 0 To ImageList1.Images.Count - 1

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

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

' Call the Sleep method to allow the user to see the image.
System.Threading.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.DoEvents()
ico.Save(apath & "icones\" & IO.Path.GetFileName(fil) & x &
".ico", System.Drawing.Imaging.ImageFormat.Icon)
Next

"Ben" <Be*@discussions.microsoft.comwrote in message
news:6B**********************************@microsof t.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.Image =
Drawing.Icon.ExtractAssociatedIcon("file.exe").ToB itmap

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*@discussions.microsoft.comwrote in message
news:2B**********************************@microsof t.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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Dim ico As Icon = Icon.ExtractAssociatedIcon(the path for
"winword.exe")
ImageList1.ImageSize = New Size(24, 24)
ImageList1.Images.Add(ico)

Dim theGraphics As Graphics = Graphics.FromHwnd(Me.Handle)

For count = 0 To ImageList1.Images.Count - 1

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

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

' Call the Sleep method to allow the user to see the image.
System.Threading.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.DoEvents()
ico.Save(apath & "icones\" & IO.Path.GetFileName(fil) & x &
".ico", System.Drawing.Imaging.ImageFormat.Icon)
Next

"Ben" <Be*@discussions.microsoft.comwrote in message
news:6B**********************************@microsof t.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.Image =
Drawing.Icon.ExtractAssociatedIcon("file.exe").ToB itmap

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*@discussions.microsoft.comwrote in message
news:E6**********************************@microsof t.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*@discussions.microsoft.comwrote in message
news:2B**********************************@microsof t.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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Dim ico As Icon = Icon.ExtractAssociatedIcon(the path for
"winword.exe")
ImageList1.ImageSize = New Size(24, 24)
ImageList1.Images.Add(ico)

Dim theGraphics As Graphics = Graphics.FromHwnd(Me.Handle)

For count = 0 To ImageList1.Images.Count - 1

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

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

' Call the Sleep method to allow the user to see the image.
System.Threading.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.DoEvents()
ico.Save(apath & "icones\" & IO.Path.GetFileName(fil) & x
&
".ico", System.Drawing.Imaging.ImageFormat.Icon)
Next

"Ben" <Be*@discussions.microsoft.comwrote in message
news:6B**********************************@microsof t.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.Image =
Drawing.Icon.ExtractAssociatedIcon("file.exe").ToB itmap

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*@discussions.microsoft.comwrote in message
news:2D**********************************@microsof t.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*@discussions.microsoft.comwrote in message
news:E6**********************************@microso ft.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*@discussions.microsoft.comwrote in message
news:2B**********************************@microso ft.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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Dim ico As Icon = Icon.ExtractAssociatedIcon(the path for
"winword.exe")
ImageList1.ImageSize = New Size(24, 24)
ImageList1.Images.Add(ico)

Dim theGraphics As Graphics = Graphics.FromHwnd(Me.Handle)

For count = 0 To ImageList1.Images.Count - 1

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

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

' Call the Sleep method to allow the user to see the
image.
System.Threading.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.DoEvents()
ico.Save(apath & "icones\" & IO.Path.GetFileName(fil) &
x
&
".ico", System.Drawing.Imaging.ImageFormat.Icon)
Next

"Ben" <Be*@discussions.microsoft.comwrote in message
news:6B**********************************@microso ft.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.Image =
Drawing.Icon.ExtractAssociatedIcon("file.exe").ToB itmap

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.microsoft.com
the attachment is there

"eBob.com" <fa******@totallybogus.comwrote in message
news:ud*************@TK2MSFTNGP04.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*@discussions.microsoft.comwrote in message
news:2D**********************************@microsof t.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*@discussions.microsoft.comwrote in message
news:E6**********************************@micros oft.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*@discussions.microsoft.comwrote in message
news:2B**********************************@micros oft.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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Dim ico As Icon = Icon.ExtractAssociatedIcon(the path for
"winword.exe")
ImageList1.ImageSize = New Size(24, 24)
ImageList1.Images.Add(ico)

Dim theGraphics As Graphics = Graphics.FromHwnd(Me.Handle)

For count = 0 To ImageList1.Images.Count - 1

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

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

' Call the Sleep method to allow the user to see the
image.
System.Threading.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.DoEvents()
ico.Save(apath & "icones\" & IO.Path.GetFileName(fil)
& x
&
".ico", System.Drawing.Imaging.ImageFormat.Icon)
Next

"Ben" <Be*@discussions.microsoft.comwrote in message
news:6B**********************************@micros oft.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.Image =
Drawing.Icon.ExtractAssociatedIcon("file.exe").To Bitmap

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.microsoft.com
the attachment is there

"eBob.com" <fa******@totallybogus.comwrote in message
news:ud*************@TK2MSFTNGP04.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*@discussions.microsoft.comwrote in message
news:2D**********************************@microsof t.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*@discussions.microsoft.comwrote in message
news:E6**********************************@microso ft.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*@discussions.microsoft.comwrote in message
news:2B**********************************@microso ft.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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Dim ico As Icon = Icon.ExtractAssociatedIcon(the path for
"winword.exe")
ImageList1.ImageSize = New Size(24, 24)
ImageList1.Images.Add(ico)

Dim theGraphics As Graphics = Graphics.FromHwnd(Me.Handle)

For count = 0 To ImageList1.Images.Count - 1

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

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

' Call the Sleep method to allow the user to see the
image.
System.Threading.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.DoEvents()
ico.Save(apath & "icones\" & IO.Path.GetFileName(fil)
& x
&
".ico", System.Drawing.Imaging.ImageFormat.Icon)
Next

"Ben" <Be*@discussions.microsoft.comwrote in message
news:6B**********************************@microso ft.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.Image =
Drawing.Icon.ExtractAssociatedIcon("file.exe").ToB itmap

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
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
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...
2
by: Steve | last post by:
How can I extract a icon from a exist program? for examle, notepad.exe.
2
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...
2
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
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: ...
0
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...
2
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...
0
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,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.