<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Visual C++ Tips &#187; SHGFI_ICONLOCATION</title>
	<atom:link href="http://weseetips.com/tag/shgfi_iconlocation/feed/" rel="self" type="application/rss+xml" />
	<link>http://weseetips.com</link>
	<description>Gold mine of Visual C++ tricks!</description>
	<lastBuildDate>Thu, 11 Mar 2010 09:09:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>How to get the icon of a file?</title>
		<link>http://weseetips.com/2008/06/03/how-to-get-the-icon-of-a-file/</link>
		<comments>http://weseetips.com/2008/06/03/how-to-get-the-icon-of-a-file/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 18:58:57 +0000</pubDate>
		<dc:creator>Jijo Raj</dc:creator>
				<category><![CDATA[Codeproject]]></category>
		<category><![CDATA[Windows Shell Pearls]]></category>
		<category><![CDATA[file icon]]></category>
		<category><![CDATA[how to get file icon]]></category>
		<category><![CDATA[icon]]></category>
		<category><![CDATA[SHGetFileInfo()]]></category>
		<category><![CDATA[SHGFI_ICON]]></category>
		<category><![CDATA[SHGFI_ICONLOCATION]]></category>
		<category><![CDATA[SHGFI_LARGEICON]]></category>
		<category><![CDATA[SHGFI_SMALLICON]]></category>

		<guid isPermaLink="false">http://weseetips.wordpress.com/?p=153</guid>
		<description><![CDATA[If you try to delete files in Vista, you can see the following dialog. Did you noticed that, for every file, it will display its corresponding file icon. That&#8217;s pretty nice thing. If you are writing your own file browser tree or list, it will be nice to display the files with their own icons. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-medium wp-image-11" src="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166" alt="" width="166" height="32" /><br />
If you try to delete files in Vista, you can see the following dialog.</p>
<p><img class="alignnone size-medium wp-image-154" src="http://siteground205.com/~weseetip/wp-content/uploads/2008/06/fileicon_messagebox.jpg?w=300" alt="" width="300" height="148" /></p>
<p>Did you noticed that, for every file, it will display its <span style="color:#0000ff;">corresponding file icon</span>. That&#8217;s pretty nice thing. If you are writing your own file browser tree or list, it will be nice to display the files with their own icons. But how can you get the file icon of a file?</p>
<p><img class="alignnone size-medium wp-image-12" src="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220" alt="" width="220" height="32" /><br />
You can use the call &#8211; <span style="color:#0000ff;">SHGetFileInfo()</span>. While calling the function, pass <span style="color:#0000ff;">SHGFI_ICON</span> as parameter. It will return handle for File icon. See the following code snippet.</p>
<pre>// The classic FooBar. <img src='http://weseetips.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
CString FilePath = _T("C:\\FooBar.zip");

// Get the file icon.
SHFILEINFO FileInfo = { 0 };
SHGetFileInfo( FilePath,
               0,
               &amp;FileInfo,
               sizeof( FileInfo ),
               SHGFI_ICON );

// FileInfo.hIcon contains Icon handle.</pre>
<p><img class="alignnone size-medium wp-image-18" src="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94" alt="" width="94" height="32" /><br />
There are more constants such as &#8211; <span style="color:#0000ff;">SHGFI_ICONLOCATION</span>, <span style="color:#0000ff;">SHGFI_LARGEICON</span>, <span style="color:#0000ff;">SHGFI_SMALLICON</span> etc. Seems they are self explanatory. <img src='http://weseetips.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><img class="alignnone size-medium wp-image-53" src="http://weseetips.files.wordpress.com/2008/03/intermediateseries.jpg?w=248" alt="" width="248" height="32" /><br />
Targeted Audience &#8211; Intermediate.</p>
]]></content:encoded>
			<wfw:commentRss>http://weseetips.com/2008/06/03/how-to-get-the-icon-of-a-file/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

