DISQUS

DISQUS Hello! LegHumped is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

LegHumped

Coding, snippets, tutorials and procrastinations
Jump to original thread »
Author

Retrieving Shell Icons in C#

Started by HJennerway · 10 months ago

Ever needed to retrieve the shell icon for a particular file type in C#? This class will retrieve the Icon associated with a file from just the extension.

using System;
using System.Runtime.InteropServices;
using System.Drawing;
 
namespace Lime49.Util ... Continue reading »

2 comments

  • I think your code sample is handle-leaking.

    From MSDN on SHGetFileInfo:
    Remarks
    If SHGetFileInfo returns an icon handle in the hIcon member of the SHFILEINFO structure pointed to by psfi, you are responsible for freeing it with DestroyIcon when you no longer need it.
  • You're right. Sample fixed. :)

Add New Comment

Returning? Login