By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,065 Members | 1,560 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,065 IT Pros & Developers. It's quick & easy.

Get the Application Icon??

P: n/a
Hello all,

I am trying to write a simple app with no forms, but which uses a system
tray icon and a context menu. I want to set the icon for the NotifyIcon to
the icon which is set for the application in the My Project settings dialog.

How can i get this icon?

Thanks in advance.
- Arthur Dent.
Apr 4 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
> I am trying to write a simple app with no forms, but which uses a system
tray icon and a context menu. I want to set the icon for the NotifyIcon to
the icon which is set for the application in the My Project settings dialog.


Assuming the name of the icon is xxx, try this

Dim s as string = Application.ProductName & ".xxx.ico"
Icon = New
Icon(Reflection.Assembly.GetExecutingAssembly.GetM anifestResourceStream(s))

Apr 4 '06 #2

P: n/a
Actually, i found i think an easier way, though maybe not the "proper" way?

I wound up doing

myNotifyIcon.Icon =
System.Drawing.Icon.ExtractAssociatedIcon(Applicat ion.GetExecutablePath())
"AMercer" <AM*****@discussions.microsoft.com> wrote in message
news:F9**********************************@microsof t.com...
I am trying to write a simple app with no forms, but which uses a system
tray icon and a context menu. I want to set the icon for the NotifyIcon
to
the icon which is set for the application in the My Project settings
dialog.


Assuming the name of the icon is xxx, try this

Dim s as string = Application.ProductName & ".xxx.ico"
Icon = New
Icon(Reflection.Assembly.GetExecutingAssembly.GetM anifestResourceStream(s))

Apr 4 '06 #3

P: n/a
> Actually, i found i think an easier way, though maybe not the "proper" way?

In my case, I have a few icons as embedded resources in my exe file, and I
can get at any one by name with the fragment in my previous post. In your
case, you want the icon associated with the app, so I think you are doing
exactly the right thing. Also, your code will work in any app without the
code needing to know the icon name, and that is a plus in my opinion.
Apr 4 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.