472,982 Members | 2,007 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 7717
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Matthew Fitzpatrick | last post by:
when multiple similar forms are opened up, windows xp can group them into an application group button on the start bar. Unfortunately, this application group uses the icon of the application's...
3
by: Sam | last post by:
I've been googling for a couple of hours now and tried some different things, but I've been unable to get the icon for a distributed access application to do anything but display the default...
2
by: shagshag | last post by:
I know how to place a notify icon in the system tray and how to hide the Form that owe the icon. The taskbar entry button is hidden, ok, but I always get an entry for the Form when I press...
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...
3
by: Wayne | last post by:
I currently have an app whose Icon I am setting. I want to set the icons in my forms at run time to that of the application icon. How do I retrieve the application Icon so that I can use it for my...
8
by: Adrian | last post by:
How do I put an icon on a form using code? Thank you.
1
by: Brahm | last post by:
Hello, I have an application with a main class subclassing the System.Windows.Form and i changed the Icon setting for the application to point to a different icon file. Now, when my application...
2
by: Randall Powell | last post by:
I am in the process of developing a Windows Service which will: (1) monitor multiple network shares; (2) marshal text file transfers into an SQL Server 2000 instance; and (3) provide messaging...
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...
6
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. I have an application that places a notifier icon in the start tray. When the application closes, the icon appears to stay, till I place my mouse...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.