Default browser icon

  • Thread starter Thread starter Jean-Luc M.
  • Start date Start date
J

Jean-Luc M.

Hi all,

Do you know how to get the default browser icon on Windows 2000 or
higher, with C# ?

I need to place a calling browser button on my software and I want to
use the default browser and his icon for image.

Thanks,

Papy
 
Jean-Luc,

This depends somewhat on what you are running on. If you are running on
Vista, then you will want to use COM interop and work with the
IApplicationAssociationRegistration interface, which you would all
QueryCurrentDefault to determine the registered name of the application that
is set to handle http requests (you can ask for mime type associations,
scheme associations, or extension associations. I assume you want to use
the scheme association for http). More info on the interface, as well as a
C++ example can be found here:

http://msdn.microsoft.com/en-us/library/bb776334(VS.85).aspx

From there, it is a matter of getting the exe of the executable and then
calling SHGetFileInfo through the P/Invoke layer to get the icon.

If you are not in Vista, you can call SHGetFileInfo to see what is
associated with the .htm extension, but it is different, as thats a file
extension association, not a scheme or mime type association (I can't seem
to find how to get the app associated with a mime type or scheme).
 
Back
Top