rgargente
rgargente

Reputation: 1840

How can I modify (but not replace) icons associated to file extensions?

I'm developing a WPF desktop application for windows. It uses its own file type, let's say .foo. This file type represents a file that has been modified by the app. For example, it was originally a .txt but now it is .txt.foo (or maybe I can use .txtfoo).

I'd like to show a small app logo on top of the original icon, similar to what source control systems do (for example showing a small lock on top of the original icon).

I don't want to make completely new icons because I don't want to confuse the user and I'd like them to see the icon they already knew before using the app. So I just want to add the small logo on top of the current icon, whatever it is at the moment.

Is this even possible?

Upvotes: 0

Views: 89

Answers (1)

JamieSee
JamieSee

Reputation: 13030

If you're using a custom file type, you would have to have a modified icon for each file you intend to rename. Your .txtfoo rather than .txt.foo would be one solution if there aren't too many file types, when your installer runs, you could register your new file types in the registry and just install the modified icons. However, if there are a lot of them this becomes problematic. The Get Registered File Types and Their Associated Icons in C# article on Code Project and C#: Set File Type Association may be helpful for some of what you're trying to do.

Otherwise, it sounds like you are looking for an icon overlay handler. This approach would mean that you'd need to have a set of small icon overlays to represent the original types that would go on top of your base .foo icon. See the Creating Icon Overlay Handlers article on MSDN for more information.

Upvotes: 2

Related Questions