How do I get the icon associated with a file type?

CodeProject has some classes you can download.

First get the FileAssociationInfo, and from that get the ProgramAssociationInfo. The pai object can give you the icon.

FileAssociationInfo fai = new FileAssociationInfo(".bob");
ProgramAssociationInfo pai = new ProgramAssociationInfo(fai.ProgID);
ProgramIcon icon = pai.DefaultIcon;

Leave a Comment