<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Visual C++ Tips</title>
	<atom:link href="http://weseetips.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://weseetips.com</link>
	<description>Gold mine of C++ and VC++ tips and tricks!</description>
	<pubDate>Wed, 07 Jan 2009 21:25:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
		<url>http://www.gravatar.com/blavatar/2a27cfcb8d59fd07c70633a322a0e774?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Visual C++ Tips</title>
		<link>http://weseetips.com</link>
	</image>
			<item>
		<title>How to Start the ScreenSaver Programmatically?</title>
		<link>http://weseetips.com/2009/01/07/how-to-start-the-screensaver-programmatically/</link>
		<comments>http://weseetips.com/2009/01/07/how-to-start-the-screensaver-programmatically/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 21:25:22 +0000</pubDate>
		<dc:creator>Jijo.Raj</dc:creator>
		
		<category><![CDATA[MFC]]></category>

		<category><![CDATA[Windows APIs]]></category>

		<category><![CDATA[DefWindowProc()]]></category>

		<category><![CDATA[SC_SCREENSAVE]]></category>

		<category><![CDATA[start screen saver]]></category>

		<category><![CDATA[start screensaver]]></category>

		<category><![CDATA[windows screensaver]]></category>

		<category><![CDATA[WM_SYSCOMMAND]]></category>

		<guid isPermaLink="false">http://weseetips.com/?p=848</guid>
		<description><![CDATA[
I&#8217;ve installed an aquarium screensaver and It works perfectly when i go to check the flames of stove.  But from yesterday onwards, the screensaver is crashing due to some reasons. Well, i just thought about - is there any way to start the screensaver programmatically and see the crash once again?  

Picture Courtesy [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-medium wp-image-11" title="Icon Description" src="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166&#038;h=32" alt="" width="166" height="32" /><br />
I&#8217;ve installed an aquarium screensaver and It works perfectly when i go to check the flames of stove. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> But from yesterday onwards, the screensaver is crashing due to some reasons. Well, i just thought about - <span style="color:#0000ff;">is there any way to start the screensaver programmatically</span> and see the crash once again? <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><img class="alignnone size-full wp-image-853" title="startscreensaver" src="http://weseetips.files.wordpress.com/2009/01/startscreensaver.jpg?w=425&#038;h=282" alt="startscreensaver" width="425" height="282" /><br />
Picture Courtesy - <a title="fordesigner" href="http://www.fordesigner.com/maps//3034-0.htm">fordesigner</a></p>
<p><img class="alignnone size-medium wp-image-12" title="Icon How Can I Do It?" src="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220&#038;h=32" alt="" width="220" height="32" /><br />
Basically you have to <span style="color:#0000ff;">send a WM_SYSCOMMAND </span>to any of the windows <span style="color:#0000ff;">with wParam as SC_SCREENSAVE.</span> And what really happens in background is, <span style="text-decoration:underline;"><span style="color:#0000ff;">the default window proc will get the message and will start the screen saver.</span></span> So you can call the <span style="color:#0000ff;">DefWindowProc()</span> directly to start the screensaver. Have a look at the code snippet.</p>
<pre>// Start the screen-saver
DefWindowProc( WM_SYSCOMMAND, SC_SCREENSAVE, 0 );</pre>
<p><img class="alignnone size-medium wp-image-18" title="Icon Note" src="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94&#038;h=32" alt="" width="94" height="32" /><br />
It was really a nice screensaver. May be I&#8217;ll reinstall it to see it again. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><img class="alignnone size-medium wp-image-51" title="beginnerseries" src="http://weseetips.files.wordpress.com/2008/03/beginnerseries.jpg?w=215&#038;h=32" alt="" width="215" height="32" /><br />
Targeted Audiance - Beginners.</p>
Posted in MFC, Windows APIs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/weseetips.wordpress.com/848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/weseetips.wordpress.com/848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/weseetips.wordpress.com/848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/weseetips.wordpress.com/848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/weseetips.wordpress.com/848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/weseetips.wordpress.com/848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/weseetips.wordpress.com/848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/weseetips.wordpress.com/848/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/weseetips.wordpress.com/848/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/weseetips.wordpress.com/848/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=weseetips.com&blog=2681721&post=848&subd=weseetips&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://weseetips.com/2009/01/07/how-to-start-the-screensaver-programmatically/feed/</wfw:commentRss>
	
		<media:content url="http://www.gravatar.com/avatar/25f1254c5049377eba563e225c217d17?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Jijo.Raj</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166" medium="image">
			<media:title type="html">Icon Description</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2009/01/startscreensaver.jpg" medium="image">
			<media:title type="html">startscreensaver</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220" medium="image">
			<media:title type="html">Icon How Can I Do It?</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94" medium="image">
			<media:title type="html">Icon Note</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/beginnerseries.jpg?w=215" medium="image">
			<media:title type="html">beginnerseries</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Print the CView directly to Printer?</title>
		<link>http://weseetips.com/2009/01/06/how-to-print-the-cview-directly-to-printer/</link>
		<comments>http://weseetips.com/2009/01/06/how-to-print-the-cview-directly-to-printer/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 22:15:40 +0000</pubDate>
		<dc:creator>Jijo.Raj</dc:creator>
		
		<category><![CDATA[MFC]]></category>

		<category><![CDATA[CFrameWnd]]></category>

		<category><![CDATA[CView::OnCmdMsg()]]></category>

		<category><![CDATA[document/view print]]></category>

		<category><![CDATA[GetActiveView()]]></category>

		<category><![CDATA[ID_FILE_PRINT]]></category>

		<category><![CDATA[ID_FILE_PRINT_DIRECT]]></category>

		<category><![CDATA[mdi print]]></category>

		<category><![CDATA[print CView]]></category>

		<category><![CDATA[print document]]></category>

		<category><![CDATA[print view]]></category>

		<category><![CDATA[sdi print]]></category>

		<guid isPermaLink="false">http://weseetips.com/?p=836</guid>
		<description><![CDATA[
 MFC&#8217;s Document/View framework have built-in printing support for applications. If you create one SDI or MDI application, you can take the print by using the File-&#62;Print menu. But the menu handling and print functionality is buried deep inside mfc framework. Well, how to take the print of current view by your own?

Picture Courtesy - [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-medium wp-image-11" title="Icon Description" src="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166&#038;h=32" alt="" width="166" height="32" /><br />
<span style="color:#0000ff;"> MFC&#8217;s Document/View framework have built-in printing support for applications.</span> If you create one SDI or MDI application, you can take the print by using the File-&gt;Print menu. But the menu handling and print functionality is buried deep inside mfc framework. <span style="color:#0000ff;">Well, how to take the print of current view by your own?</span></p>
<p><img class="alignnone size-full wp-image-841" title="printview" src="http://weseetips.files.wordpress.com/2009/01/printview.jpg?w=510&#038;h=367" alt="printview" width="510" height="367" /><br />
Picture Courtesy - <a href="http://www.daycad.com/">DayCad</a>.</p>
<p><img class="alignnone size-medium wp-image-12" title="Icon How Can I Do It?" src="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220&#038;h=32" alt="" width="220" height="32" /><br />
You have to call <span style="color:#0000ff;">CView::OnCmdMsg()</span> by passing <span style="color:#0000ff;">ID_FILE_PRINT</span> or <span style="color:#0000ff;">ID_FILE_PRINT_DIRECT</span>. If ID_FILE_PRINT is passed, the printer dialog will be shown and for ID_FILE_PRINT_DIRECT, the print will be taken directly with default printer parameters. Have a look at the code snippet.</p>
<pre>// Get the active view.
CFrameWnd* pFrameWnd = (CFrameWnd*)AfxGetApp()-&gt;GetMainWnd();
CView* pView = pFrameWnd-&gt;GetActiveView();

if( pView != NULL )
{
    // Send Print message.
    // If you want to print directly, then change ID_FILE_PRINT
    // to ID_FILE_PRINT_DIRECT.
    pView-&gt;OnCmdMsg( ID_FILE_PRINT, 0, 0, 0 );
}</pre>
<p><img class="alignnone size-medium wp-image-18" title="Icon Note" src="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94&#038;h=32" alt="" width="94" height="32" /><br />
Its interesting to know MFC internals. isn&#8217;t it?</p>
<p><img class="alignnone size-medium wp-image-53" title="intermediateseries" src="http://weseetips.files.wordpress.com/2008/03/intermediateseries.jpg?w=248&#038;h=32" alt="" width="248" height="32" /><br />
Targeted Audience - Intermediate.</p>
Posted in MFC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/weseetips.wordpress.com/836/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/weseetips.wordpress.com/836/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/weseetips.wordpress.com/836/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/weseetips.wordpress.com/836/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/weseetips.wordpress.com/836/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/weseetips.wordpress.com/836/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/weseetips.wordpress.com/836/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/weseetips.wordpress.com/836/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/weseetips.wordpress.com/836/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/weseetips.wordpress.com/836/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=weseetips.com&blog=2681721&post=836&subd=weseetips&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://weseetips.com/2009/01/06/how-to-print-the-cview-directly-to-printer/feed/</wfw:commentRss>
	
		<media:content url="http://www.gravatar.com/avatar/25f1254c5049377eba563e225c217d17?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Jijo.Raj</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166" medium="image">
			<media:title type="html">Icon Description</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2009/01/printview.jpg" medium="image">
			<media:title type="html">printview</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220" medium="image">
			<media:title type="html">Icon How Can I Do It?</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94" medium="image">
			<media:title type="html">Icon Note</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/intermediateseries.jpg?w=248" medium="image">
			<media:title type="html">intermediateseries</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Enable Password Mask in Editbox?</title>
		<link>http://weseetips.com/2009/01/04/how-to-enable-password-mask-in-editbox/</link>
		<comments>http://weseetips.com/2009/01/04/how-to-enable-password-mask-in-editbox/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 21:07:21 +0000</pubDate>
		<dc:creator>Jijo.Raj</dc:creator>
		
		<category><![CDATA[MFC]]></category>

		<category><![CDATA[* in editbox]]></category>

		<category><![CDATA[CEdit]]></category>

		<category><![CDATA[editbox *]]></category>

		<category><![CDATA[editbox password char]]></category>

		<category><![CDATA[editbox set password char]]></category>

		<category><![CDATA[ES_PASSWORD]]></category>

		<category><![CDATA[password chat in edit box]]></category>

		<category><![CDATA[password edit box]]></category>

		<category><![CDATA[password mask]]></category>

		<category><![CDATA[SetPasswordChar()]]></category>

		<guid isPermaLink="false">http://weseetips.com/?p=827</guid>
		<description><![CDATA[
User Authentication is common in windows application. Usually the password editbox is masked and won&#8217;t show the real password. But to to enable the password masking in Editbox?

Picture Courtesy - NoteBookForums.


You have to enable ES_PASSWORD style of editbox and have to call SetPasswordChar() to set the Password masking character. You can do it in CDialog::OnInitDialog(). [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-medium wp-image-11" title="Icon Description" src="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166&#038;h=32" alt="" width="166" height="32" /><br />
User Authentication is common in windows application. Usually the password editbox is masked and won&#8217;t show the real password. <span style="color:#0000ff;">But to to enable the password masking in Editbox?</span></p>
<p><span style="color:#0000ff;"><img class="alignnone size-full wp-image-832" title="editpasswordmask" src="http://weseetips.files.wordpress.com/2009/01/editpasswordmask.jpg?w=510&#038;h=382" alt="editpasswordmask" width="510" height="382" /></span></p>
<p><span style="color:#0000ff;"><span style="color:#000000;">Picture Courtesy - <a title="NotebookForums" href="http://www.notebookforums.com/thread124080.html" target="_blank">NoteBookForums</a>.</span><br />
</span></p>
<p><img class="alignnone size-medium wp-image-12" title="Icon How Can I Do It?" src="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220&#038;h=32" alt="" width="220" height="32" /><br />
You have to <span style="color:#0000ff;">enable <strong>ES_PASSWORD</strong> </span>style of editbox and have to <span style="color:#0000ff;">call SetPasswordChar() to set the Password masking character.</span> You can do it in CDialog::OnInitDialog(). See the code snippet below.</p>
<pre>BOOL CRabbitDlg::OnInitDialog()
{
    ...  

    // Get the Edit by using CtrlID.
    CEdit* pEdit = (CEdit*) GetDlgItem( IDC_EDIT_PASSWORD );  

    // Set the password char.
    pEdit-&gt;SetPasswordChar( '*' );  

    // Now modify the style to enable ES_PASSWORD.
    pEdit-&gt;ModifyStyle( 0, ES_PASSWORD );  

    return TRUE;
}</pre>
<p><img class="alignnone size-medium wp-image-18" title="Icon Note" src="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94&#038;h=32" alt="" width="94" height="32" /><br />
Unless I&#8217;m very mistaken, it was while setting up samba server in Linux, where i had an interesting incident related to password. I was asked to type the password and save it. When I took the dialog again, the displayed password length was different. I was confused. I retyped and saved it again and again. Very lately i came to know that its a trick to fool the people who try to guess the password by length. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><img class="alignnone size-medium wp-image-51" title="beginnerseries" src="http://weseetips.files.wordpress.com/2008/03/beginnerseries.jpg?w=215&#038;h=32" alt="" width="215" height="32" /><br />
Targeted Audience - Beginners.</p>
Posted in MFC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/weseetips.wordpress.com/827/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/weseetips.wordpress.com/827/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/weseetips.wordpress.com/827/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/weseetips.wordpress.com/827/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/weseetips.wordpress.com/827/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/weseetips.wordpress.com/827/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/weseetips.wordpress.com/827/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/weseetips.wordpress.com/827/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/weseetips.wordpress.com/827/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/weseetips.wordpress.com/827/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=weseetips.com&blog=2681721&post=827&subd=weseetips&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://weseetips.com/2009/01/04/how-to-enable-password-mask-in-editbox/feed/</wfw:commentRss>
	
		<media:content url="http://www.gravatar.com/avatar/25f1254c5049377eba563e225c217d17?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Jijo.Raj</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166" medium="image">
			<media:title type="html">Icon Description</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2009/01/editpasswordmask.jpg" medium="image">
			<media:title type="html">editpasswordmask</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220" medium="image">
			<media:title type="html">Icon How Can I Do It?</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94" medium="image">
			<media:title type="html">Icon Note</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/beginnerseries.jpg?w=215" medium="image">
			<media:title type="html">beginnerseries</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Expand/Collapse TreeCtrl nodes by using Enter Key?</title>
		<link>http://weseetips.com/2009/01/02/how-to-expandcollapse-treectrl-nodes-by-using-enter-key/</link>
		<comments>http://weseetips.com/2009/01/02/how-to-expandcollapse-treectrl-nodes-by-using-enter-key/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 23:23:46 +0000</pubDate>
		<dc:creator>Jijo.Raj</dc:creator>
		
		<category><![CDATA[MFC]]></category>

		<category><![CDATA[collapse tree by enter key]]></category>

		<category><![CDATA[CTreeCtrl]]></category>

		<category><![CDATA[expand tree by enter key]]></category>

		<category><![CDATA[GetDlgCtrlID()]]></category>

		<category><![CDATA[GetItemState()]]></category>

		<category><![CDATA[GetSelectedItem()]]></category>

		<category><![CDATA[PreTranslateMessage()]]></category>

		<category><![CDATA[TVIS_EXPANDED]]></category>

		<category><![CDATA[VK_RETURN]]></category>

		<category><![CDATA[WM_KEYDOWN]]></category>

		<category><![CDATA[WM_SUBSTRACT]]></category>

		<guid isPermaLink="false">http://weseetips.com/?p=817</guid>
		<description><![CDATA[
You can see Tree Control, almost in every heavy windows applications. They are very convineant  method for organize things in hierarchy. But by default Tree control doesn&#8217;t support expand/collapse of its tree nodes by Enter key. Is there any way to do that?

Picture Courtesy - hawaiibonsai

Yes, you can! All you want to do is - [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-medium wp-image-11" title="Icon Description" src="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166&#038;h=32" alt="" width="166" height="32" /><br />
You can see Tree Control, almost in every heavy windows applications. They are very convineant  method for organize things in hierarchy. But <span style="color:#0000ff;">by default Tree control doesn&#8217;t support expand/collapse of its tree nodes by Enter key.</span> Is there any way to do that?</p>
<p><img class="alignnone size-full wp-image-820" title="expandcollapsetreectrl" src="http://weseetips.files.wordpress.com/2009/01/expandcollapsetreectrl.jpg?w=350&#038;h=367" alt="expandcollapsetreectrl" width="350" height="367" /><br />
Picture Courtesy - <a title="hawaiibonsai" href="http://hawaiibonsai.e-siteworks.com/bonsai/view.nhtml?profile=bonsai&amp;UID=10019" target="_blank">hawaiibonsai</a></p>
<p><img class="alignnone size-medium wp-image-12" title="Icon How Can I Do It?" src="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220&#038;h=32" alt="" width="220" height="32" /><br />
Yes, you can! All you want to do is - <span style="color:#0000ff;">Override <strong>PreTranslateMessage()</strong></span> in your dialog and <span style="color:#0000ff;">handle all <strong>WM_KEYDOWN</strong> messages for your tree control</span>. <span style="color:#0000ff;">If,</span> the key is <strong><span style="color:#0000ff;">VK_RETURN</span></strong>, i.e. enter key, then <span style="color:#0000ff;">check</span> whether the <span style="color:#0000ff;">current selected node in TreeCtrl is expanded or collapsed</span> and <span style="color:#0000ff;">modify the key stroke as <strong>WM_ADD</strong> key</span> or <span style="color:#0000ff;"><strong>WM_SUBSTRACT</strong> key accordingly.</span> The idea is, if you press +, then tree node expands and for - key, the tree node collapse - which is the default behavior of tree control. Well, have a look at the code snippet.</p>
<pre>BOOL CRabbitDlg::PreTranslateMessage(MSG* pMsg)
{
    // Check whether its a keypress.
    if( pMsg-&gt;message == WM_KEYDOWN )
    {
        // Check whether its for our tree control.
        UINT CtrlId = ::GetDlgCtrlID( pMsg-&gt;hwnd );
        if( CtrlId == IDC_TREECTRL )
        {
            // Check whether its enter key.
            if( pMsg-&gt;wParam == VK_RETURN)
            {
                // Check whether the currently selected item is
                HTREEITEM CurrentItem = m_TreeCtrl.GetSelectedItem();
                if( m_TreeCtrl.GetItemState( CurrentItem, TVIS_EXPANDED )
                        &amp; TVIS_EXPANDED )
                {
                    // Current Item is Expanded.
                    // So send - Key code to collapse it.
                    pMsg-&gt;wParam = VK_SUBTRACT;
                }
                else
                {
                    // Current Item is Collapsed.
                    // So send + Key code to Expand it.
                    pMsg-&gt;wParam = VK_ADD;
                }
            }
        }
    }

    return CDialog::PreTranslateMessage(pMsg);
}</pre>
<p><img class="alignnone size-medium wp-image-18" title="Icon Note" src="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94&#038;h=32" alt="" width="94" height="32" /><br />
If you want the expand entire child nodes under a perticular node, then press * key. I used to use this techniqe to report performance bugs. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><img class="alignnone size-medium wp-image-53" title="intermediateseries" src="http://weseetips.files.wordpress.com/2008/03/intermediateseries.jpg?w=248&#038;h=32" alt="" width="248" height="32" /><br />
Targeted Audience - Intermediate.</p>
Posted in MFC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/weseetips.wordpress.com/817/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/weseetips.wordpress.com/817/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/weseetips.wordpress.com/817/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/weseetips.wordpress.com/817/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/weseetips.wordpress.com/817/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/weseetips.wordpress.com/817/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/weseetips.wordpress.com/817/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/weseetips.wordpress.com/817/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/weseetips.wordpress.com/817/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/weseetips.wordpress.com/817/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=weseetips.com&blog=2681721&post=817&subd=weseetips&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://weseetips.com/2009/01/02/how-to-expandcollapse-treectrl-nodes-by-using-enter-key/feed/</wfw:commentRss>
	
		<media:content url="http://www.gravatar.com/avatar/25f1254c5049377eba563e225c217d17?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Jijo.Raj</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166" medium="image">
			<media:title type="html">Icon Description</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2009/01/expandcollapsetreectrl.jpg" medium="image">
			<media:title type="html">expandcollapsetreectrl</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220" medium="image">
			<media:title type="html">Icon How Can I Do It?</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94" medium="image">
			<media:title type="html">Icon Note</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/intermediateseries.jpg?w=248" medium="image">
			<media:title type="html">intermediateseries</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Watch Variables in Binary by using Visual Studio Debugger?</title>
		<link>http://weseetips.com/2009/01/01/how-to-watch-variables-in-binary-by-using-visual-studio-debugger/</link>
		<comments>http://weseetips.com/2009/01/01/how-to-watch-variables-in-binary-by-using-visual-studio-debugger/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 20:18:38 +0000</pubDate>
		<dc:creator>Jijo.Raj</dc:creator>
		
		<category><![CDATA[Debugging Tips]]></category>

		<category><![CDATA[Visual Studio]]></category>

		<category><![CDATA[visual studio debugger]]></category>

		<category><![CDATA[watch variable in binary]]></category>

		<category><![CDATA[watch value in binary]]></category>

		<category><![CDATA[visual studio variable in binary]]></category>

		<category><![CDATA[watch binary]]></category>

		<category><![CDATA[variable in binary]]></category>

		<category><![CDATA[visual studio debugging tips]]></category>

		<guid isPermaLink="false">http://weseetips.com/?p=806</guid>
		<description><![CDATA[
In visual studio you can watch variable values in different formats. For instance, for viewing in hex add this to watch window - var,x and for octal - var,o. But its a pity that visual studio doesn&#8217;t support displaying variables in binaries. So how can you watch the value of a variable in binary, with [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-medium wp-image-11" title="Icon Description" src="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166&#038;h=32" alt="" width="166" height="32" /><br />
In visual studio you can watch variable values in different formats. For instance, for viewing in hex add this to watch window - <strong>var,x</strong> and for octal - <strong>var,o</strong>. But its a pity that <span style="color:#0000ff;">visual studio doesn&#8217;t support displaying variables in binaries</span>. So how can <strong>you watch</strong> the value of a <strong>variable</strong> in binary, <strong>with debugger</strong>? <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><img class="alignnone size-full wp-image-808" title="watchvarinbinary_1" src="http://weseetips.files.wordpress.com/2009/01/watchvarinbinary_1.jpg?w=500&#038;h=300" alt="watchvarinbinary_1" width="500" height="300" /><br />
Image Courtesy - <a title="Pixdaus" href="http://pixdaus.com/single.php?id=22790" target="_blank">Pixdaus</a>.</p>
<p><img class="alignnone size-medium wp-image-12" title="Icon How Can I Do It?" src="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220&#038;h=32" alt="" width="220" height="32" /><br />
Well, we have to <span style="color:#0000ff;">utilize the special feature of visual studio debugger</span>. Basically the <span style="color:#0000ff;">watch window </span>is not just a tool to display the variable value. It <span style="color:#0000ff;">can evaluate and execute small code snippets as well. </span>If you <span style="color:#0000ff;">add a function call to the watch window,</span> that<span style="color:#0000ff;"> function will be called</span> when debugger refreshes the watch values. So, all you have to do is - Add a global function which accepts integer value, converts it to binary string then display it to output window. Have a look at the function.</p>
<pre>// Global function which converts integer to binary
// and dump to the output window.
void DumpBinary( DWORD Value )
{
    // Buffer to hold the converted string.
    TCHAR Buffer[255] = { 0 };

    // Convert the value to binary string.
    _itot( Value, Buffer, 2 );

    // Display to output window.
    CString csMessage;
    csMessage.Format( _T("\n%d in binary: %s"), Value, Buffer );
    OutputDebugString( csMessage );
}</pre>
<p>Now <span style="color:#0000ff;">if you want to convert the 100 to binary,</span> break at some location and just add <span style="color:#0000ff;"><strong>DumpBinary(100)</strong></span> to watch window and check the output in the output window. See the screenshot below.</p>
<p><img class="alignnone size-full wp-image-807" title="watchvarinbinary" src="http://weseetips.files.wordpress.com/2009/01/watchvarinbinary.jpg?w=510&#038;h=382" alt="watchvarinbinary" width="510" height="382" /></p>
<p><img class="alignnone size-medium wp-image-18" title="Icon Note" src="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94&#038;h=32" alt="" width="94" height="32" /><br />
Just now I realized - how powerful the Visual Studio Debugger is. Hats off to Visual Studio Team!</p>
<p>Well, please note that <span style="color:#0000ff;">in visual studio 2008 </span>and may be in siblings, When you add this to watch window, <span style="color:#0000ff;">its possible to see this error</span> - &#8220;<span style="color:#0000ff;">CXX0001: Error: error attempting to execute user function&#8221;</span>. In that case <span style="color:#0000ff;">just click the &#8220;Evaluate button&#8221;</span> which appears next to it and the expression will be re-evaluate.</p>
<p><img class="alignnone size-full wp-image-54" title="advancedseries" src="http://weseetips.files.wordpress.com/2008/03/advancedseries.jpg?w=217&#038;h=32" alt="advancedseries" width="217" height="32" /><br />
Targeted Audiance - Advanced.</p>
Posted in Debugging Tips, Visual Studio&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/weseetips.wordpress.com/806/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/weseetips.wordpress.com/806/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/weseetips.wordpress.com/806/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/weseetips.wordpress.com/806/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/weseetips.wordpress.com/806/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/weseetips.wordpress.com/806/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/weseetips.wordpress.com/806/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/weseetips.wordpress.com/806/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/weseetips.wordpress.com/806/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/weseetips.wordpress.com/806/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=weseetips.com&blog=2681721&post=806&subd=weseetips&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://weseetips.com/2009/01/01/how-to-watch-variables-in-binary-by-using-visual-studio-debugger/feed/</wfw:commentRss>
	
		<media:content url="http://www.gravatar.com/avatar/25f1254c5049377eba563e225c217d17?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Jijo.Raj</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166" medium="image">
			<media:title type="html">Icon Description</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2009/01/watchvarinbinary_1.jpg" medium="image">
			<media:title type="html">watchvarinbinary_1</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220" medium="image">
			<media:title type="html">Icon How Can I Do It?</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2009/01/watchvarinbinary.jpg" medium="image">
			<media:title type="html">watchvarinbinary</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94" medium="image">
			<media:title type="html">Icon Note</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/advancedseries.jpg" medium="image">
			<media:title type="html">advancedseries</media:title>
		</media:content>
	</item>
		<item>
		<title>Happy New Year 2009!!!</title>
		<link>http://weseetips.com/2008/12/30/happy-new-year-2009/</link>
		<comments>http://weseetips.com/2008/12/30/happy-new-year-2009/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 21:22:54 +0000</pubDate>
		<dc:creator>Jijo.Raj</dc:creator>
		
		<category><![CDATA[Announcements]]></category>

		<category><![CDATA[Happy New Year]]></category>

		<guid isPermaLink="false">http://weseetips.com/?p=793</guid>
		<description><![CDATA[May all your dreams come true this year!!!

Posted in Announcements&#160;&#160;&#160;&#160;&#160;&#160;     ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:left;">May all your dreams come true this year!!!</p>
<p><img class="alignnone size-full wp-image-794" title="happynewyear2009" src="http://weseetips.files.wordpress.com/2008/12/happynewyear2009.jpg?w=510&#038;h=382" alt="happynewyear2009" width="510" height="382" /></p>
Posted in Announcements&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/weseetips.wordpress.com/793/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/weseetips.wordpress.com/793/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/weseetips.wordpress.com/793/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/weseetips.wordpress.com/793/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/weseetips.wordpress.com/793/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/weseetips.wordpress.com/793/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/weseetips.wordpress.com/793/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/weseetips.wordpress.com/793/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/weseetips.wordpress.com/793/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/weseetips.wordpress.com/793/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=weseetips.com&blog=2681721&post=793&subd=weseetips&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://weseetips.com/2008/12/30/happy-new-year-2009/feed/</wfw:commentRss>
	
		<media:content url="http://www.gravatar.com/avatar/25f1254c5049377eba563e225c217d17?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Jijo.Raj</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/12/happynewyear2009.jpg" medium="image">
			<media:title type="html">happynewyear2009</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Enable XP/Vista themes in your Dialog?</title>
		<link>http://weseetips.com/2008/12/30/how-to-enable-xpvista-themes-in-your-dialog/</link>
		<comments>http://weseetips.com/2008/12/30/how-to-enable-xpvista-themes-in-your-dialog/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 21:12:50 +0000</pubDate>
		<dc:creator>Jijo.Raj</dc:creator>
		
		<category><![CDATA[Visual C++]]></category>

		<category><![CDATA[add xp theme]]></category>

		<category><![CDATA[adding custom resource]]></category>

		<category><![CDATA[application manifest]]></category>

		<category><![CDATA[custom resource]]></category>

		<category><![CDATA[dialog manifest]]></category>

		<category><![CDATA[manifest file]]></category>

		<category><![CDATA[vista look and feel]]></category>

		<category><![CDATA[vista theme]]></category>

		<category><![CDATA[vista themes to application]]></category>

		<category><![CDATA[vista themes to dialog]]></category>

		<category><![CDATA[xp look and feel]]></category>

		<category><![CDATA[xp theme]]></category>

		<category><![CDATA[xp theme to dialog]]></category>

		<category><![CDATA[xp themes to dialog]]></category>

		<category><![CDATA[xp themese in your appliaction]]></category>

		<guid isPermaLink="false">http://weseetips.com/?p=774</guid>
		<description><![CDATA[
From Windows XP onwards, the basic control look and feel have improved drastically. Previously, they were merely flat style controls without any effects- the maximum you can do is to change the control color and mouse cursor icon( I hope you do remember the Jungle Theme of those old win98 days). In Vista its even [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-medium wp-image-11" title="Icon Description" src="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166&#038;h=32" alt="" width="166" height="32" /><br />
<span style="color:#0000ff;">From Windows XP onwards, the basic control look and feel have improved drastically.</span> Previously, they were merely flat style controls without any effects- the maximum you can do is to change the control color and mouse cursor icon( I hope you do remember the Jungle Theme of those old win98 days). In Vista its even more stylish. <span style="color:#0000ff;">But is it possible to give the same look &amp; feel effects to our applications as well?</span></p>
<p><img class="alignnone size-full wp-image-784" title="xp_themes" src="http://weseetips.files.wordpress.com/2008/12/xp_themes.jpg?w=500&#038;h=360" alt="xp_themes" width="500" height="360" /></p>
<p><img class="alignnone size-medium wp-image-12" title="Icon How Can I Do It?" src="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220&#038;h=32" alt="" width="220" height="32" /><br />
Yes. You can. You just have to <span style="color:#0000ff;">add a manifest file to your application.</span> Well follow the detailed steps about how to do it. Well, we are going to apply Vista look and feel to the following dialog. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><img class="alignnone size-full wp-image-783" title="xp_theme_7" src="http://weseetips.files.wordpress.com/2008/12/xp_theme_7.jpg?w=333&#038;h=202" alt="xp_theme_7" width="333" height="202" /></p>
<p>1) The manifest format is specified below. <span style="color:#0000ff;">Copy it to notepad</span> and change the &#8220;<span style="text-decoration:underline;"><strong>ExeName</strong></span>&#8221; to the name of your application. For instance if your exename is Rabbit.exe, then &#8220;<span style="text-decoration:underline;"><strong>ExeName</strong></span>&#8221; is &#8220;Rabbit&#8221;.</p>
<pre>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
&lt;assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"&gt;
&lt;assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="X86"
    name="<span style="text-decoration:underline;"><strong>ExeName</strong></span>"
    type="win32"
/&gt;
&lt;description&gt;Application Description&lt;/description&gt;
&lt;dependency&gt;
    &lt;dependentAssembly&gt;
        &lt;assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        /&gt;
    &lt;/dependentAssembly&gt;
&lt;/dependency&gt;
&lt;/assembly&gt;</pre>
<p>2) Now<span style="color:#0000ff;"> insert a new resource</span>.</p>
<p><img class="alignnone size-full wp-image-777" title="xp_theme_1" src="http://weseetips.files.wordpress.com/2008/12/xp_theme_1.jpg?w=510&#038;h=387" alt="xp_theme_1" width="510" height="387" /><br />
3) Now <span style="color:#0000ff;">add a new Custom Resource</span> with <span style="color:#0000ff;">Resource ID as <strong>24</strong></span>.</p>
<p><img class="alignnone size-full wp-image-778" title="xp_theme_2" src="http://weseetips.files.wordpress.com/2008/12/xp_theme_2.jpg?w=376&#038;h=300" alt="xp_theme_2" width="376" height="300" /></p>
<p>4) Now <span style="color:#0000ff;">copy-paste the manifest contents</span> to new resource and save it. Make sure you&#8217;ve changed the &#8220;<span style="text-decoration:underline;"><strong>ExeName</strong></span>&#8221; to your application name.</p>
<p><img class="alignnone size-full wp-image-779" title="xp_theme_3" src="http://weseetips.files.wordpress.com/2008/12/xp_theme_3.jpg?w=510&#038;h=382" alt="xp_theme_3" width="510" height="382" /></p>
<p>5) Now <span style="color:#0000ff;">take the properties</span> of our new resource -  &#8220;IDR_DEFAULT1&#8243;.</p>
<p><img class="alignnone size-full wp-image-780" title="xp_theme_4" src="http://weseetips.files.wordpress.com/2008/12/xp_theme_4.jpg?w=510&#038;h=389" alt="xp_theme_4" width="510" height="389" /></p>
<p>6) Now <span style="color:#0000ff;">change the Resource ID</span> to &#8220;<span style="color:#0000ff;"><strong>1</strong></span>&#8220;.</p>
<p><img class="alignnone size-full wp-image-781" title="xp_theme_5" src="http://weseetips.files.wordpress.com/2008/12/xp_theme_5.jpg?w=510&#038;h=389" alt="xp_theme_5" width="510" height="389" /></p>
<p>7) That&#8217;s it. <span style="color:#0000ff;">Now compile and run</span> the application. And now see the command buttons in Vista Style. Cool! isn&#8217;t it?</p>
<p><img class="alignnone size-full wp-image-782" title="xp_theme_6" src="http://weseetips.files.wordpress.com/2008/12/xp_theme_6.jpg?w=333&#038;h=202" alt="xp_theme_6" width="333" height="202" /></p>
<p><img class="alignnone size-medium wp-image-18" title="Icon Note" src="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94&#038;h=32" alt="" width="94" height="32" /><br />
<span style="color:#0000ff;">I searched a lot for the screenshot of the old &#8220;Jungle Theme&#8221; of Windows 98.</span> Its a pity that I couldn&#8217;t find it. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> If you find one such, please do notify. <span style="color:#0000ff;">I&#8217;m getting nostalgic</span>. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><img class="alignnone size-medium wp-image-53" title="intermediateseries" src="http://weseetips.files.wordpress.com/2008/03/intermediateseries.jpg?w=248&#038;h=32" alt="" width="248" height="32" /><br />
Targeted Audience - Intermediate.</p>
Posted in Visual C++&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/weseetips.wordpress.com/774/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/weseetips.wordpress.com/774/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/weseetips.wordpress.com/774/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/weseetips.wordpress.com/774/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/weseetips.wordpress.com/774/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/weseetips.wordpress.com/774/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/weseetips.wordpress.com/774/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/weseetips.wordpress.com/774/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/weseetips.wordpress.com/774/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/weseetips.wordpress.com/774/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=weseetips.com&blog=2681721&post=774&subd=weseetips&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://weseetips.com/2008/12/30/how-to-enable-xpvista-themes-in-your-dialog/feed/</wfw:commentRss>
	
		<media:content url="http://www.gravatar.com/avatar/25f1254c5049377eba563e225c217d17?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Jijo.Raj</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166" medium="image">
			<media:title type="html">Icon Description</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/12/xp_themes.jpg" medium="image">
			<media:title type="html">xp_themes</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220" medium="image">
			<media:title type="html">Icon How Can I Do It?</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/12/xp_theme_7.jpg" medium="image">
			<media:title type="html">xp_theme_7</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/12/xp_theme_1.jpg" medium="image">
			<media:title type="html">xp_theme_1</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/12/xp_theme_2.jpg" medium="image">
			<media:title type="html">xp_theme_2</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/12/xp_theme_3.jpg" medium="image">
			<media:title type="html">xp_theme_3</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/12/xp_theme_4.jpg" medium="image">
			<media:title type="html">xp_theme_4</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/12/xp_theme_5.jpg" medium="image">
			<media:title type="html">xp_theme_5</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/12/xp_theme_6.jpg" medium="image">
			<media:title type="html">xp_theme_6</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94" medium="image">
			<media:title type="html">Icon Note</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/intermediateseries.jpg?w=248" medium="image">
			<media:title type="html">intermediateseries</media:title>
		</media:content>
	</item>
		<item>
		<title>How to Load Bitmap and Access the Bitmap Data?</title>
		<link>http://weseetips.com/2008/12/28/how-to-load-bitmap-and-access-the-bitmap-data/</link>
		<comments>http://weseetips.com/2008/12/28/how-to-load-bitmap-and-access-the-bitmap-data/#comments</comments>
		<pubDate>Sun, 28 Dec 2008 17:23:49 +0000</pubDate>
		<dc:creator>Jijo.Raj</dc:creator>
		
		<category><![CDATA[Windows APIs]]></category>

		<category><![CDATA[LoadImage()]]></category>

		<category><![CDATA[GetBitmapBits()]]></category>

		<category><![CDATA[SetBitmapBits()]]></category>

		<category><![CDATA[load bitmap file]]></category>

		<category><![CDATA[how to load bitmap]]></category>

		<category><![CDATA[how to access bitmap data]]></category>

		<category><![CDATA[access bitmap data]]></category>

		<category><![CDATA[get bitmap data]]></category>

		<category><![CDATA[get bitmap pixels]]></category>

		<category><![CDATA[bitmap pixels]]></category>

		<category><![CDATA[CBitmap]]></category>

		<category><![CDATA[BITMAP]]></category>

		<category><![CDATA[GetBitmap()]]></category>

		<category><![CDATA[how to process bitmap]]></category>

		<category><![CDATA[bitmap processing]]></category>

		<category><![CDATA[bitmap image processing]]></category>

		<guid isPermaLink="false">http://weseetips.com/?p=763</guid>
		<description><![CDATA[
While doing image processing, you will be loading the bitmap, access each pixel, process it and set it back. You can get/set each pixel by calling functions which is time consuming. Well, It will be nice if its possible to access the entire bitmap buffer and process it. Since access the data by pointers is [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-medium wp-image-11" title="Icon Description" src="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166&#038;h=32" alt="" width="166" height="32" /><br />
While doing image processing, you will be loading the bitmap, access each pixel, process it and set it back. You can get/set each pixel by calling functions which is time consuming. Well, <span style="color:#0000ff;">It will be nice if its possible to access the entire bitmap buffer and process it.</span> Since access the data by pointers is so fast compared to get/set each pixel by function calls. But how to load the bitmap, <strong>cut it</strong> and access the bitmap data? <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><img class="alignnone size-full wp-image-770" title="accessbitmapdata2" src="http://weseetips.files.wordpress.com/2008/12/accessbitmapdata2.jpg?w=464&#038;h=390" alt="accessbitmapdata2" width="464" height="390" /></p>
<p><img class="alignnone size-medium wp-image-12" title="Icon How Can I Do It?" src="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220&#038;h=32" alt="" width="220" height="32" /><br />
You can <span style="color:#0000ff;">load the bitmap by</span> using <span style="color:#0000ff;">LoadImage()</span> and can call <span style="color:#0000ff;">GetBitmapBits()</span> to <span style="color:#0000ff;">access the pixel data</span> of bitmap. After processing, you can call <span style="color:#0000ff;">SetBitmapBits()</span> to <span style="color:#0000ff;">set the processed data back to bitmap.</span> Check the code snippet below.</p>
<pre>// Load and process the bitmap data.
void LoadAndProcessBitmap( TCHAR* pBitmapPath )
{
    // Load the image bitmapt.
    HBITMAP hBitmap = 0;
    hBitmap = (HBITMAP)LoadImage( NULL,
                                  pBitmapPath,
                                  IMAGE_BITMAP,
                                  0,
                                  0,
                                  LR_LOADFROMFILE | LR_DEFAULTSIZE);

    // Access bitmap data.
    CBitmap Bitmap;
    Bitmap.Attach( hBitmap );

    // Calculate buffer for bitmap bits.
    BITMAP BitmapInfo = { 0 };
    Bitmap.GetBitmap( &amp;BitmapInfo );

    // Calculate the size of required buffer.
    DWORD BitmapImageSize = BitmapInfo.bmHeight *
        BitmapInfo.bmWidth *
        ( BitmapInfo.bmBitsPixel / 8 );

    // Allocate memory.
    BYTE* pBitmapData = new BYTE[ BitmapImageSize ];
    ZeroMemory( pBitmapData, BitmapImageSize );

    // Get bitmap data.
    Bitmap.GetBitmapBits( BitmapImageSize, pBitmapData );

    // Now access and process bitmap data
    // as you wish!

    // Now after processing, set the bitmap data back.
    Bitmap.SetBitmapBits( BitmapImageSize, pBitmapData );

    // Now you can use the processed bitmap for your purpose.
    // For instance, save to disk, display in your dialog etc.

    // Delete bitmap data after use.
    delete pBitmapData;
    pBitmapData = 0;
}</pre>
<p><img class="alignnone size-medium wp-image-18" title="Icon Note" src="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94&#038;h=32" alt="" width="94" height="32" /><br />
Here I&#8217;ve used <span style="color:#0000ff;">CBitmap for ease.</span> But this one can be done with pure windows apis as well.</p>
<p><img class="alignnone size-medium wp-image-53" title="intermediateseries" src="http://weseetips.files.wordpress.com/2008/03/intermediateseries.jpg?w=248&#038;h=32" alt="" width="248" height="32" /><br />
Targeted Audience - Intermediate.</p>
Posted in Windows APIs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/weseetips.wordpress.com/763/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/weseetips.wordpress.com/763/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/weseetips.wordpress.com/763/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/weseetips.wordpress.com/763/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/weseetips.wordpress.com/763/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/weseetips.wordpress.com/763/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/weseetips.wordpress.com/763/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/weseetips.wordpress.com/763/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/weseetips.wordpress.com/763/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/weseetips.wordpress.com/763/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=weseetips.com&blog=2681721&post=763&subd=weseetips&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://weseetips.com/2008/12/28/how-to-load-bitmap-and-access-the-bitmap-data/feed/</wfw:commentRss>
	
		<media:content url="http://www.gravatar.com/avatar/25f1254c5049377eba563e225c217d17?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Jijo.Raj</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166" medium="image">
			<media:title type="html">Icon Description</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/12/accessbitmapdata2.jpg" medium="image">
			<media:title type="html">accessbitmapdata2</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220" medium="image">
			<media:title type="html">Icon How Can I Do It?</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94" medium="image">
			<media:title type="html">Icon Note</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/intermediateseries.jpg?w=248" medium="image">
			<media:title type="html">intermediateseries</media:title>
		</media:content>
	</item>
		<item>
		<title>How to enable warning for Deprecated Functions?</title>
		<link>http://weseetips.com/2008/12/22/how-to-enable-warning-for-deprecated-functions/</link>
		<comments>http://weseetips.com/2008/12/22/how-to-enable-warning-for-deprecated-functions/#comments</comments>
		<pubDate>Mon, 22 Dec 2008 20:06:45 +0000</pubDate>
		<dc:creator>Jijo.Raj</dc:creator>
		
		<category><![CDATA[Visual C++ Preprocessors]]></category>

		<category><![CDATA[#pragma deprecated]]></category>

		<category><![CDATA[deprecated]]></category>

		<category><![CDATA[deprecated classes]]></category>

		<category><![CDATA[deprecated function]]></category>

		<category><![CDATA[deprecated function warning]]></category>

		<category><![CDATA[deprecated functions]]></category>

		<category><![CDATA[deprecated member functions]]></category>

		<category><![CDATA[deprecated overloaded functions]]></category>

		<category><![CDATA[deprecated symbols]]></category>

		<category><![CDATA[visual studio 2005]]></category>

		<category><![CDATA[Visual Studio 2008]]></category>

		<category><![CDATA[warning deprecated function]]></category>

		<category><![CDATA[__declspec deprecated]]></category>

		<category><![CDATA[__declspec(deprecated)]]></category>

		<guid isPermaLink="false">http://weseetips.com/?p=754</guid>
		<description><![CDATA[
If you port some of your old vc6 projects to Visual Studio 2005, you might have noticed that several function have become deprecated. Well, if you are a framework writer, its handy to notify user about the function which existed but deprecated. Well, how to do it?


You can use #pragma deprecated or __declspec(deprecated) to mark [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-medium wp-image-11" title="Icon Description" src="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166&#038;h=32" alt="" width="166" height="32" /><br />
If you port some of your old vc6 projects to Visual Studio 2005, you might have noticed that several function have become deprecated. Well, <span style="color:#0000ff;">if you are a framework writer, its handy to notify user about the function which existed but deprecated.</span> Well, how to do it?<br />
<img class="alignnone size-full wp-image-757" title="depricatedfunction2" src="http://weseetips.files.wordpress.com/2008/12/depricatedfunction2.jpg?w=375&#038;h=264" alt="depricatedfunction2" width="375" height="264" /></p>
<p><img class="alignnone size-medium wp-image-12" title="Icon How Can I Do It?" src="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220&#038;h=32" alt="" width="220" height="32" /><br />
You can use <span style="color:#0000ff;">#pragma deprecated</span> or <span style="color:#0000ff;">__declspec(deprecated)</span> to mark the deprecated functions. Then, if the function is used, compiler will shoot a warning while compiling. Check the code snippet below for how to do it in different conditions.</p>
<p><span style="text-decoration:underline;"><strong>1) Deprecated Functions</strong></span></p>
<pre>// If you want to set Fun1() and Fun2() as deprecated.
#pragma deprecated(Fn1, Fn2)
Fn1();   // C4995
Fn2();   // C4995</pre>
<p>or</p>
<pre>// If you use __declspec(deprecated), then you can
// provide an error message as well.
void __declspec(deprecated("Fn1 is not supported")) Fn1()
{}</pre>
<p><span style="text-decoration:underline;"><strong>2) Depricated Class</strong></span></p>
<pre>// If you want to set a class as deprecated.
#pragma deprecated( CFooBar )
CFooBar obj;   // C4995</pre>
<p>or</p>
<pre>// If you want to mark deprecated by using __declspec(deprecated)
class __declspec( deprecated("No Longer supported")) CFooBar
{};</pre>
<p><span style="text-decoration:underline;"><strong>3) Overloaded Member functions</strong></span></p>
<pre>class CFooBar
{
public:
    void Fun1()
    {}

    // Deprecating one of overloaded function.
    void __declspec(deprecated) Fun1( int a )
    {}
};
...
CFooBar obj;
obj.Fun1();        // Okay.
obj.Fun1( 0 );    // Error.</pre>
<p><span style="text-decoration:underline;"><strong>4) Error on deprecated function usage</strong></span><br />
If you enable - <span style="color:#0000ff;">&#8220;Warning as errors&#8221;</span> in Project settings, then the <span style="color:#0000ff;">usage deprecated functions will halt the compilation</span> which will be even more noticeable. Check the screenshot.<br />
<img class="alignnone size-full wp-image-758" title="deprecatedfunctions1" src="http://weseetips.files.wordpress.com/2008/12/deprecatedfunctions1.jpg?w=510&#038;h=355" alt="deprecatedfunctions1" width="510" height="355" /></p>
<p><img class="alignnone size-medium wp-image-18" title="Icon Note" src="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94&#038;h=32" alt="" width="94" height="32" /><br />
Well, take care that this functionality is <span style="color:#0000ff;">only available for visual studio 2005 and younger siblings.<br />
</span></p>
<p><img class="alignnone size-medium wp-image-51" title="beginnerseries" src="http://weseetips.files.wordpress.com/2008/03/beginnerseries.jpg?w=215&#038;h=32" alt="" width="215" height="32" /><br />
Targeted Audience - Beginners.</p>
Posted in Visual C++ Preprocessors&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/weseetips.wordpress.com/754/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/weseetips.wordpress.com/754/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/weseetips.wordpress.com/754/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/weseetips.wordpress.com/754/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/weseetips.wordpress.com/754/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/weseetips.wordpress.com/754/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/weseetips.wordpress.com/754/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/weseetips.wordpress.com/754/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/weseetips.wordpress.com/754/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/weseetips.wordpress.com/754/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=weseetips.com&blog=2681721&post=754&subd=weseetips&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://weseetips.com/2008/12/22/how-to-enable-warning-for-deprecated-functions/feed/</wfw:commentRss>
	
		<media:content url="http://www.gravatar.com/avatar/25f1254c5049377eba563e225c217d17?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Jijo.Raj</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166" medium="image">
			<media:title type="html">Icon Description</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/12/depricatedfunction2.jpg" medium="image">
			<media:title type="html">depricatedfunction2</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220" medium="image">
			<media:title type="html">Icon How Can I Do It?</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/12/deprecatedfunctions1.jpg" medium="image">
			<media:title type="html">deprecatedfunctions1</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94" medium="image">
			<media:title type="html">Icon Note</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/beginnerseries.jpg?w=215" medium="image">
			<media:title type="html">beginnerseries</media:title>
		</media:content>
	</item>
		<item>
		<title>How to use Interlocked Singly Linked Lists?</title>
		<link>http://weseetips.com/2008/12/21/how-to-use-interlocked-singly-linked-lists/</link>
		<comments>http://weseetips.com/2008/12/21/how-to-use-interlocked-singly-linked-lists/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 21:26:15 +0000</pubDate>
		<dc:creator>Jijo.Raj</dc:creator>
		
		<category><![CDATA[Windows APIs]]></category>

		<category><![CDATA[InitializeSListHead()]]></category>

		<category><![CDATA[interlocked list]]></category>

		<category><![CDATA[interlocked singly linked list]]></category>

		<category><![CDATA[InterlockedFlushSList()]]></category>

		<category><![CDATA[InterlockedPopEntrySList()]]></category>

		<category><![CDATA[InterlockedPushEntrySList()]]></category>

		<category><![CDATA[linked list]]></category>

		<category><![CDATA[SLIST_ENTRY]]></category>

		<category><![CDATA[synchornized list]]></category>

		<guid isPermaLink="false">http://weseetips.com/?p=744</guid>
		<description><![CDATA[
Well, STL can provide you almost all kind of containers you want. But only one problem exists - they are not thread safe. If multiple threads are accessing the container at once, you have to add synchronization to them, by using mutex or similar ones. Well, the good news is if you need a singly [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignnone size-medium wp-image-11" title="Icon Description" src="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166&#038;h=32" alt="" width="166" height="32" /><br />
Well, <span style="color:#0000ff;">STL </span>can provide you almost all kind of <span style="color:#0000ff;">containers </span>you want. But only one problem exists - they <span style="color:#0000ff;">are not thread safe.</span> If multiple threads are accessing the container at once, you have to add synchronization to them, by using mutex or similar ones. Well, the good news is <span style="color:#0000ff;">if you need a singly linked list - windows have a built in one which is already synchonized</span>.</p>
<p><img class="alignnone size-full wp-image-749" title="singlylinkedlist" src="http://weseetips.files.wordpress.com/2008/12/singlylinkedlist.jpg?w=360&#038;h=360" alt="singlylinkedlist" width="360" height="360" /></p>
<p><img class="alignnone size-medium wp-image-12" title="Icon How Can I Do It?" src="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220&#038;h=32" alt="" width="220" height="32" /><br />
First of all you have to <span style="color:#0000ff;">declare a structure to hold your data.</span> Keep in mind that the <span style="color:#0000ff;">first member should be of type - </span><span style="color:#0000ff;"><strong>SLIST_ENTRY</strong></span><span style="color:#0000ff;">.</span> Then only the api&#8217;s can work with it. Then you have to <span style="color:#0000ff;">initialize the list by calling <strong>InitializeSListHead()</strong>.</span> You can <span style="color:#0000ff;">push and pop</span> elements by calling <span style="color:#0000ff;"><strong>InterlockedPushEntrySList()</strong> and <strong>InterlockedPopEntrySList()</strong>.</span> And can <span style="color:#0000ff;">flush it by calling <strong>InterlockedFlushSList()</strong></span>. Check the code snippet below. Its taken from MSDN and modified accordingly.</p>
<pre>typedef struct _LIST_DATA
{
    SLIST_ENTRY ItemEntry; // SLIST_ENTRY should be first.
    int Data;               // Your data.
} LIST_DATA, *PLIST_DATA;

int _tmain(int argc, _TCHAR* argv[])
{
    PSLIST_ENTRY FirstEntry, ListEntry;
    SLIST_HEADER ListHead;
    PLIST_DATA pListData = 0;

    // Initialize the list header.
    InitializeSListHead(&amp;ListHead);

    // Insert 10 items into the list.
    ULONG Count;
    for( Count = 0; Count &lt; 10; ++Count )
    {
        // pListData = (PLIST_DATA)malloc(sizeof(*pListData));
        pListData = new LIST_DATA;
        pListData-&gt;Data = Count;
        FirstEntry = InterlockedPushEntrySList(&amp;ListHead,
                       &amp;pListData-&gt;ItemEntry);
    }

    // Remove 10 items from the list.
    for( Count = 0; Count &lt; 10; ++Count )
    {
        ListEntry = InterlockedPopEntrySList(&amp;ListHead);
        pListData = (PLIST_DATA)( ListEntry );
        cout &lt;&lt; "Item : " &lt;&lt; pListData-&gt;Data &lt;&lt; endl;
        // free( pListData );
        delete pListData;
    }

    // Flush the list and verify that the items are gone.
    ListEntry = InterlockedFlushSList(&amp;ListHead);
    FirstEntry = InterlockedPopEntrySList(&amp;ListHead);

    if (FirstEntry != NULL)
    {
        printf("Error: List is not empty.");
    }
}</pre>
<p><img class="alignnone size-medium wp-image-18" title="Icon Note" src="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94&#038;h=32" alt="" width="94" height="32" /><br />
I think the best name will be Interlocked stack, since its using push and pop and behaves like stack. I can&#8217;t find why its named as a singly linked list. What do you think?</p>
<p><img class="alignnone size-medium wp-image-51" title="beginnerseries" src="http://weseetips.files.wordpress.com/2008/03/beginnerseries.jpg?w=215&#038;h=32" alt="" width="215" height="32" /><br />
Targeted Audience - Beginners.</p>
Posted in Windows APIs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/weseetips.wordpress.com/744/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/weseetips.wordpress.com/744/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/weseetips.wordpress.com/744/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/weseetips.wordpress.com/744/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/weseetips.wordpress.com/744/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/weseetips.wordpress.com/744/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/weseetips.wordpress.com/744/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/weseetips.wordpress.com/744/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/weseetips.wordpress.com/744/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/weseetips.wordpress.com/744/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=weseetips.com&blog=2681721&post=744&subd=weseetips&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://weseetips.com/2008/12/21/how-to-use-interlocked-singly-linked-lists/feed/</wfw:commentRss>
	
		<media:content url="http://www.gravatar.com/avatar/25f1254c5049377eba563e225c217d17?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Jijo.Raj</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_description.jpg?w=166" medium="image">
			<media:title type="html">Icon Description</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/12/singlylinkedlist.jpg" medium="image">
			<media:title type="html">singlylinkedlist</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_howcanidoit.jpg?w=220" medium="image">
			<media:title type="html">Icon How Can I Do It?</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/icon_note.jpg?w=94" medium="image">
			<media:title type="html">Icon Note</media:title>
		</media:content>

		<media:content url="http://weseetips.files.wordpress.com/2008/03/beginnerseries.jpg?w=215" medium="image">
			<media:title type="html">beginnerseries</media:title>
		</media:content>
	</item>
	</channel>
</rss>