software you can take with you

Peter Foot

Microsoft Windows Phone Development MVP

Application and File Icons with Mobile In The Hand 4.0

There are a number of scenarios in which you want to retrieve the icon associated with a particular executable or other file type. One example is when building a file browser, you might also want to extract the icon associated with your application or another. The full .NET framework contains Icon.ExtractAssociatedIcon() for this very purpose. Mobile In The Hand includes a helper function to achieve the same result from the Compact Framework. Simply use the following code:-

  1. Icon i = IconHelper.ExtractAssociatedIcon(filePath);

filePath is the full path to any file. The icon will either be the icon associated with a particular file type or in the case of executables will be the embedded application icon (or a generic application icon if not present). The result is a regular System.Drawing.Icon type which you can draw using the Graphics class normally.

The documentation for the IconHelper class is available in the online library. For more information about Mobile In The Hand see the product page.

Comments

No Comments

About PeterFoot

Peter Foot is co-author of the Microsoft Mobile Development Handbook published by Microsoft Press. Peter has been awarded the Microsoft Most Valuable Professional (MVP) accolade since 2003 for his involvement in the Microsoft .NET Compact Framework developer community. Alongside an active presence in several online forums and communities, attendance at developer conferences and involvement in shared-source projects, Peter has also written a number of technical articles and maintains an active technical blog.
Copyright © 2001-2013 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy. OrcsWeb's Windows Cloud Server Hosting