2

Can you suggest something for changing the files icons in C#? What I means here is that does C# has any class that we can use to change the icons of files. For example, can I replace notepad file icon with doc file icon in c#?

I know we can extract the icon of a file, but I am looking for applying new icon to a file.

let me try to explain it in details. I am working on a windows app that process files. This app creates a special folder and user can create files and folders into this folders. Now when user creates a files, i want to apply custom icon which shows it as under processing. When processing is done, the file icon will be changed to processing complete. I hope this makes sense now.

Thanks

Deepak Kumar
  • 672
  • 4
  • 15
  • 31
  • why -1 to this question? – Deepak Kumar Feb 15 '12 at 11:30
  • I would imagine "this question does not show any research effort". What have you tried yourself? Do you have any code you have issues with? Do you understand that Windows sets icons per file type, not file in the exception of executables, where an icon is embedded in the binary? – J. Steen Feb 15 '12 at 11:34
  • Files do not have icons, applications do. – tafa Feb 15 '12 at 11:36
  • 1
    exact duplicate: http://stackoverflow.com/questions/2990242/how-to-change-executable-icon-from-c-sharp-code-not-my-app-icon – fardjad Feb 15 '12 at 11:36
  • @Steen - I have been trying for it from last 15 days. Not exactly this but something like this. This is not the correct approach basically. This is an alternate for the actual problem. The correct approach is something like SVN. But I am so stupid that I couldn't make it working. I am running under time bounds. So I am just implementing this approach for the time being. – Deepak Kumar Feb 15 '12 at 11:47
  • @Deepak - you may have searched for 15 days, but the questions doesn't **show** what you have tried and where you got stuck. If you include those details, maybe someone can help you further. – Hans Kesting Feb 15 '12 at 11:55
  • @Hans - I cannot post the whole project. But what I want to use is here "http://us.generation-nt.com/answer/ishelliconoverlayidentifier-c-help-54925982.html". Please go through the link and tell me how can I use this code snippet. What I want is when I add a file in a special folder created by my application, it should show a different icon as processing and when processing is done, it should show a different icon on the file in question. – Deepak Kumar Feb 15 '12 at 11:59
  • In the link, how can I tell to SHELL that this is the folder, which I want to change icons? Like in SVN, when we add a file, it applies a blue + icon over it. I want similar functionality. I have SVN source code as well. But that is in C++ and I don't work in C++. But I know they have used the same code mentioned in the link above to apply icon overlays. This is something I want http://stackoverflow.com/questions/8906619/how-to-resize-windows-icon-overlay – Deepak Kumar Feb 15 '12 at 12:07
  • Any solution to this problem? – Deepak Kumar Feb 16 '12 at 04:35

1 Answers1

2

You will have to write custom shell extension for this. Which are known as "Icon Overlay Handlers". This is the same way by which applications like TortoiseSVN add icons in explorer.

See this MSDN article and this code example

Maheep
  • 5,539
  • 3
  • 28
  • 47
  • This is what I came to know when I started R&D for this. I have unmanaged as well as managed DLLs as well. But I am unable to use it. I do work in web applications. This is first time I am working in windows application. – Deepak Kumar Feb 15 '12 at 11:51
  • Please post something about how to use this code. I am doing R&D from last 2 weeks so I have searched almost every link that says ICON OVERLAY. – Deepak Kumar Feb 15 '12 at 11:53