khraLiezx
khraLiezx

Reputation: 1

Adding custom icons to files on desktop crashes explorer.exe C#

I have a Windows service application to add custom icons to files and directories using .Net Framework 4.5.2 SharpShell library.

When I try to create a Microsoft Excel file on desktop, file icon moves to default file position on the desktop (top left).

If I create any other type of file (e.g. Microsoft Word), file gets created at the exact location where I clicked.

And if I create multiple Microsoft Excel files consecutively, explorer.exe crashes and restarts.

What can I do about it?

  [ComVisible(true)]
    public class MyIconOVerlay: SharpIconOverlayHandler
    {
        protected override bool CanShowOverlay(string path, FILE_ATTRIBUTE attributes)
        {
            // some process 
        }

        protected override Icon GetOverlayIcon()
        {
            return Properties.Resources.overlay_icon_inverted;
        }

        protected override int GetPriority()
        {
            return 50;
        }
    }

I tried to create another task to add icons, different from actual explorer.exe process.

Upvotes: 0

Views: 55

Answers (0)

Related Questions