How can I get the app icon?

  • Thread starter Thread starter Marc Scheuner [MVP ADSI]
  • Start date Start date
M

Marc Scheuner [MVP ADSI]

Folks,

I am trying to find a way (hopefully nice'n'clean, no hack) to get the
app's icon in a .NET app.

I can see that the resulting EXE has an app icon - my Win32 resource
tool shows it, no problem.

But how can I access that program icon (the one being displayed in
Windows Explorer - *NOT* the icon on the main form) ? I would like to
write a .NET shell that contains other apps / assemblies, and I'd like
to show their program icons in a list view (like Win Explorer).

All I find is stuff on how to access the .NET resources - stuff that's
stored in MyNameSpace.MyForm.resources - but the app icon doesn't seem
to reside there......

Any takers? Any tutorials on how to access the program icon in a .NET
app?

Thanks!
Marc

================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
Folks,

I am trying to find a way (hopefully nice'n'clean, no hack) to get the
app's icon in a .NET app.

I can see that the resulting EXE has an app icon - my Win32 resource
tool shows it, no problem.

But how can I access that program icon (the one being displayed in
Windows Explorer - *NOT* the icon on the main form) ? I would like to
write a .NET shell that contains other apps / assemblies, and I'd like
to show their program icons in a list view (like Win Explorer).

All I find is stuff on how to access the .NET resources - stuff that's
stored in MyNameSpace.MyForm.resources - but the app icon doesn't seem
to reside there......

Any takers? Any tutorials on how to access the program icon in a .NET
app?

How do I get the associated Icon from a file in the file system?
http://www.syncfusion.com/faq/winforms/search/660.asp
 
How do I get the associated Icon from a file in the file system?

That works, thanks Patrick.

But I'm still amazed and puzzled that .NET doesn't natively support at
least reading its own icons (from the currently running assembly) -
seems like such a basic function everyone will use at some point in
time! ;-)

Marc

================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 
Marc said:
That works, thanks Patrick.

But I'm still amazed and puzzled that .NET doesn't natively support at
least reading its own icons (from the currently running assembly) -
seems like such a basic function everyone will use at some point in
time! ;-)

But its not a .NET resource, its a native resource!

However, you would have thought that since you can add a native resource
through Reflection.Emit.ModuleBuilder.DefineUnmanagedResource there would be
a corresponding API to get access to such resources.

Richard
 
Back
Top