468,760 Members | 1,967 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,760 developers. It's quick & easy.

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 2082

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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Mehdi Mousavi | last post: by
6 posts views Thread by Mohammad-Reza | last post: by
2 posts views Thread by Steve | last post: by
2 posts views Thread by Alexander VS | last post: by
6 posts views Thread by Udi | last post: by
2 posts views Thread by Spam Catcher | last post: by
reply views Thread by Sathyaish | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.