<?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>&#62;devblog_ &#187; Tray</title>
	<atom:link href="http://devblog.itsth.com/tag/tray/feed/" rel="self" type="application/rss+xml" />
	<link>http://devblog.itsth.com</link>
	<description>Thoughts on developing shareware</description>
	<lastBuildDate>Wed, 14 Dec 2011 16:29:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Tips for minimizing your app to the Tray</title>
		<link>http://devblog.itsth.com/2008/11/28/tips-for-minimizing-your-app-to-the-tray/</link>
		<comments>http://devblog.itsth.com/2008/11/28/tips-for-minimizing-your-app-to-the-tray/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 11:59:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[microsoft]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Shell_NotifyIcon]]></category>
		<category><![CDATA[Tray]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://devblog.itsth.com/?p=38</guid>
		<description><![CDATA[It&#8217;s a nice feature for your software if your customer can minimize it as an icon to the system tray. From our &#8220;minimize to tray&#8221; program I learned a few things about. Here&#8217;s a rundown of the basic and not-so-basic tricks. You can add / modify / remove a tray icon with Shell_NotifyIcon. You can [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a nice feature for your software if your customer can minimize it as an icon to the system tray. From our &#8220;<a href="http://www.easy2sync.com/en/produkte/TheBest-Minimize-To-Tray.php">minimize to tray</a>&#8221; program I learned  a few things about. Here&#8217;s a rundown of the basic and not-so-basic tricks.</p>
<ol>
<li>You can add / modify / remove a tray icon with Shell_NotifyIcon. You can specify a callback message (for example WM_USER) to react to left/right clicks on the icon. To hide your program when minimized simply use ShowWindow.</li>
<li>To minimize to the tray when your user click the minimize button, handle the WM_NCLBUTTONDOWN message and watch for the HitTest HTMINBUTTON (or HTCLOSE if you want to override the X-button).</li>
<li>If you want to prevent Windows from hiding the icon, make a tiny chnge to the icon every now and then. (Do this only if you have good reason!)</li>
<li>You can use DrawAnimatedRects for a minmize animation. Use FindWindow(&#8220;Shell_TrayWnd&#8221;, &#8230;) to find the location (= target reactangle for the animation)</li>
<li>If the windows explorer crashes, the tray icons are gone and your user can&#8217;t get your application back. To detect this, use Shell_NotifyIcon(NIM_MODIFY, &#8230; every now and then and check the return value. If the function fails, then your icon is gone and you have to add in again.</li>
<li>Don&#8217;t forget to remove the tray icon if your program closes while being minimized.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://devblog.itsth.com/2008/11/28/tips-for-minimizing-your-app-to-the-tray/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

