468,462 Members | 1,786 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

get icon from application exe

I want to get the icon from my application exe file

dim myIcon as Icon = ... -> "myApplication.exe,0"

how can I do that?
Nov 20 '05 #1
16 7552
Cor
Hi Dominique,

I never tested it have to do that still but I thought this was where you
where looking for?

Herfried will surely confirm when he does his round.

:-)

\\\By Herfried K Wagner
foo.Icon = _
New Icon( _
[Assembly].GetExecutingAssembly().GetManifestResourceStream( _
"WindowsApplication1.Ball.ico" _
) _
)
///

Cor

Nov 20 '05 #2
Cor,

* "Cor" <no*@non.com> scripsit:
I never tested it have to do that still but I thought this was where you
where looking for?

Herfried will surely confirm when he does his round.


I am not sure if this will solve the problem, but it will work for
embedded icon ressources.

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
* "Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> scripsit:
I want to get the icon from my application exe file

dim myIcon as Icon = ... -> "myApplication.exe,0"

how can I do that?


AFAIS p/invoke on 'ExtractIconEx' if the icon is embedded as Win32
resource.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
used that one, it works

thx
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bv*************@ID-208219.news.uni-berlin.de...
* "Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> scripsit:
I want to get the icon from my application exe file

dim myIcon as Icon = ... -> "myApplication.exe,0"

how can I do that?


AFAIS p/invoke on 'ExtractIconEx' if the icon is embedded as Win32
resource.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #5
Addendum:
Herfried will surely confirm when he does his round.


I am not sure if this will solve the problem, but it will work for
embedded icon ressources.


It won't work because the application icon is embedded as Win32
resource and .NET cannot deal with Win32 resources.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6
Cor
Hi Herfried,

Can you give me that routine dominique is using, I will try it also.

But finding out that wheel that you have 10000 times done, you know I will
distribute it only with your name.
Cor
Nov 20 '05 #7
Corm

* "Cor" <no*@non.com> scripsit:
Can you give me that routine dominique is using, I will try it also.

But finding out that wheel that you have 10000 times done, you know I will
distribute it only with your name.


I don't have written a routine using 'ExtractIconEx', but you may find
working samples here:

<http://www.google.ch/groups?q=dotnet+ExtractIconEx>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #8
it works here...
code:

Public Declare Function DestroyIcon Lib "User32.dll" (ByRef phicon As
IntPtr) As Boolean
Public Declare Function ExtractIconEx Lib "shell32.dll" _
(ByVal lpszFile As String, ByVal nIconIndex As Integer, _
ByRef phiconLarge As IntPtr, ByRef phiconSmall As IntPtr, ByVal nIcons As
Integer) _
As IntPtr
....
Dim iconPtr As IntPtr
Dim myIcon As Icon
ExtractIconEx(Application.ExecutablePath, 0, iconPtr, Nothing, 1)
-> returnvalue is number of icons found, so normally check for > 0 :-)
myIcon = Icon.FromHandle(iconPtr)
....
when "finished using" the icon:
DestroyIcon(iconPtr)
dominique
"Cor" <no*@non.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi Herfried,

Can you give me that routine dominique is using, I will try it also.

But finding out that wheel that you have 10000 times done, you know I will
distribute it only with your name.
Cor

Nov 20 '05 #9
Cor
Hi Dominique,

Thanks

2 questions,
written by yourself (because I add that when I redistribute that)
combobox problem Net 1.0 or Net 1.1
Cor
Nov 20 '05 #10
Cor
Hi Herfried,

That I can also do myself but than I do not know which one is working.

And it is a German site how can I read that.

I try that one from Dominique, she is nice for me.

Cor
Nov 20 '05 #11
* "Cor" <no*@non.com> scripsit:
I try that one from Dominique, she is nice for me.


Her code seems to be OK.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #12
Cor
Hi Herfried,

I forgot the

:-)))

Cor
Nov 20 '05 #13
to set things right

I'm a he not a she ;-)
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:bv*************@ID-208219.news.uni-berlin.de...
* "Cor" <no*@non.com> scripsit:
I try that one from Dominique, she is nice for me.


Her code seems to be OK.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #14
> written by yourself (because I add that when I redistribute that)

euh yes, with help of herfried's hint :-)
combobox problem Net 1.0 or Net 1.1
workaround by doing .selectedIndex=-1 twice
and add a (boolean) variable IgnoreEvent which is true "around" the first
..selectindex=-1 so the switch to index 0 is ignored...

something like:
sub button_click()
IgnoreEvent = true
comboBox1.selectedIndex = -1
IgnoreEvent = false
comboBox1.selectedIndex = -1
end sub

sub combobox_selectedIndexChangedOrSomethingLikeThat()
if(IgnoreEvent) then exit Sub
'do stuff
end sub
dominique

"Cor" <no*@non.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl... Hi Dominique,

Thanks

2 questions,
Cor

Nov 20 '05 #15
Corina,

* "Cor" <no*@non.com> scripsit:
I forgot the

:-)))


I already thought that...

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #16
* "Dominique Vandensteen" <domi.vds_insert@tralala_tenforce.com> scripsit:
to set things right

I'm a he not a she ;-)


:-(

Everybody here was so happy to see a "she" here...

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #17

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Matthew Fitzpatrick | last post: by
2 posts views Thread by shagshag | last post: by
2 posts views Thread by Vic | last post: by
3 posts views Thread by Wayne | last post: by
8 posts views Thread by Adrian | last post: by
1 post views Thread by Brahm | last post: by
4 posts views Thread by randy1200 | last post: by
6 posts views Thread by eSolTec, Inc. 501(c)(3) | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.