<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>VC Tips++</title>
	<atom:link href="http://vctipsplusplus.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://vctipsplusplus.wordpress.com</link>
	<description>Another vc++ blog... aiming high..</description>
	<lastBuildDate>Mon, 26 Jul 2010 02:41:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='vctipsplusplus.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/0851e26db52f1b74feea0801d8695812?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>VC Tips++</title>
		<link>http://vctipsplusplus.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://vctipsplusplus.wordpress.com/osd.xml" title="VC Tips++" />
	<atom:link rel='hub' href='http://vctipsplusplus.wordpress.com/?pushpress=hub'/>
		<item>
		<title>WARNING :UNREFERENCED_PARAMETER(..);</title>
		<link>http://vctipsplusplus.wordpress.com/2010/07/26/warning-unreferenced_parameter/</link>
		<comments>http://vctipsplusplus.wordpress.com/2010/07/26/warning-unreferenced_parameter/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 02:41:11 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[Do You Know ?]]></category>
		<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[unreferenced formal parameter]]></category>
		<category><![CDATA[UNREFERENCED_PARAMETER]]></category>
		<category><![CDATA[warning C4100]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=232</guid>
		<description><![CDATA[It is a good programming practice -   if you optimize your source code , handle all type of memory leaks, remove the warnings,  document your code , provide better spacing, etc. This provides another one to look into your code so easily. Today, let me discuss something about WARNINGS.. You can disable all the compiler warning using the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=232&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://vctipsplusplus.files.wordpress.com/2010/07/warning.jpg"><img class="aligncenter size-full wp-image-233" title="warning" src="http://vctipsplusplus.files.wordpress.com/2010/07/warning.jpg?w=368&#038;h=300" alt="warning image" width="368" height="300" /></a></p>
<p>It is a good programming practice -   if you optimize your source code , handle all type of memory leaks, remove the warnings,  document your code , provide better spacing, etc.</p>
<p>This provides another one to look into your code so easily.</p>
<p>Today, let me discuss something about WARNINGS.. <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<ul>
<li> You can disable all the compiler warning using the compiler switch /w : Oh no.. this is so dangerous, and i think, this is a bad programming practice.</li>
<li> You can treat all warnings as errors using the switch /WX. : This is nice programming.. but it takes a lot of precious time to complete your app.</li>
<li> using /Wdn, you can disable the specified warning..</li>
</ul>
<p>The default warning level for VS 2008 is Level 3, (i think so), but MSDN says</p>
<p>For a new project, it may be best to use /W4 in all  compilations. This will ensure the fewest possible hard-to-find code  defects. cool.. <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>suppose in a function like,</p>
<pre>int DumpMe(int nCount, int nMode)
{
    return nCount++;
}</pre>
<p>here, we are not using the variable <strong>nMode </strong>now, but at a later version of your app, you are going to use the <strong>nMode</strong>.</p>
<p>During compilation, definitely, you will  get the warning</p>
<pre><span style="color:#ff0000;">warning C4100: 'nMode' : unreferenced formal parameter (if the warning level is 4)</span></pre>
<p>Here to avoid that warning message, you can use 2 ways.</p>
<p>1. comment the nMode variable. like</p>
<p>int DumpMe(int nCount, int /*nMode*/)</p>
<p>2. Use the UNREFERENCED_PARAMETER macro. like</p>
<p><strong>UNREFERENCED_PARAMETER(nMode);</strong></p>
<p>It&#8217;s just to suppress the warning &#8211; and the compiler will optimize it out since the code doesn&#8217;t do anything.</p>
<p>- For vctipsplusplus,</p>
<p>BIJU</p>
<br />Filed under: <a href='http://vctipsplusplus.wordpress.com/category/do-you-know/'>Do You Know ?</a>, <a href='http://vctipsplusplus.wordpress.com/category/visual-c/'>Visual C++</a> Tagged: <a href='http://vctipsplusplus.wordpress.com/tag/unreferenced-formal-parameter/'>unreferenced formal parameter</a>, <a href='http://vctipsplusplus.wordpress.com/tag/unreferenced_parameter/'>UNREFERENCED_PARAMETER</a>, <a href='http://vctipsplusplus.wordpress.com/tag/warning-c4100/'>warning C4100</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vctipsplusplus.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vctipsplusplus.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vctipsplusplus.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vctipsplusplus.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/232/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=232&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2010/07/26/warning-unreferenced_parameter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d90dac60288e7ff492767e846063591?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">BijU</media:title>
		</media:content>

		<media:content url="http://vctipsplusplus.files.wordpress.com/2010/07/warning.jpg" medium="image">
			<media:title type="html">warning</media:title>
		</media:content>
	</item>
		<item>
		<title>Run Time Class Information</title>
		<link>http://vctipsplusplus.wordpress.com/2010/04/21/run-time-class-information/</link>
		<comments>http://vctipsplusplus.wordpress.com/2010/04/21/run-time-class-information/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 12:44:37 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[Do You Know ?]]></category>
		<category><![CDATA[My Readings]]></category>
		<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[DECLARE_DYNAMIC]]></category>
		<category><![CDATA[IMPLEMENT]]></category>
		<category><![CDATA[RTCI]]></category>
		<category><![CDATA[Runtime Class Information]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=219</guid>
		<description><![CDATA[Do you know how to add RTCI support to your class? Derive the class from CObject. class CSimple : public CObject { }; Use the DECLARE_DYNAMIC macro in your class declaration, as shown here: class CSimple : public CObject { DECLARE_DYNAMIC( CSimple ) }; Use the IMPLEMENT_DYNAMIC macro in the implementation file (.CPP) of your [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=219&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">Do you know how to add RTCI support to your class?</div>
<div id="_mcePaste">
<ul>
<li>Derive the class from CObject.</li>
</ul>
</div>
<div id="_mcePaste">
<p style="padding-left:30px;">class CSimple : public CObject</p>
</div>
<div id="_mcePaste">
<p style="padding-left:30px;">{</p>
</div>
<div id="_mcePaste">
<p style="padding-left:30px;">};</p>
</div>
<div id="_mcePaste">
<ul>
<li>Use the DECLARE_DYNAMIC macro in your class declaration, as shown here:</li>
</ul>
</div>
<div id="_mcePaste">
<address>class CSimple : public CObject</address>
</div>
<div id="_mcePaste">
<address> {</address>
</div>
<div id="_mcePaste">
<address> DECLARE_DYNAMIC( CSimple )</address>
<address>};</address>
</div>
<div id="_mcePaste">
<ul>
<li>Use the IMPLEMENT_DYNAMIC macro in the implementation file (.CPP) of your class. This macro takes as arguments the name of the class and its base class, as follows:</li>
</ul>
</div>
<address>IMPLEMENT_DYNAMIC(CSimple, CObject )</address>
<address> </address>
<address> </address>
<address> </address>
<div id="_mcePaste">for vctipsplusplus,</div>
<div id="_mcePaste">BijU</div>
<div id="_mcePaste">&#8220;We cannot have everything in life, but God is aware and is generous to give what we need.&#8221;</div>
<p>Do you know how to add RTCI support to your class?<br />
Derive the class from CObject.</p>
<p>class CSimple : public CObject{<br />
};Use the DECLARE_DYNAMIC macro in your class declaration, as shown here:class CSimple : public CObject{DECLARE_DYNAMIC( CSimple )};Use the IMPLEMENT_DYNAMIC macro in the implementation file (.CPP) of your class. This macro takes as arguments the name of the class and its base class, as follows:IMPLEMENT_DYNAMIC(CSimple, CObject )for vctipsplusplus,BijU&#8221;We cannot have everything in life, but God is aware and is generous to give what we need.&#8221;</p>
<br />Filed under: <a href='http://vctipsplusplus.wordpress.com/category/do-you-know/'>Do You Know ?</a>, <a href='http://vctipsplusplus.wordpress.com/category/visual-c/my-readings/'>My Readings</a>, <a href='http://vctipsplusplus.wordpress.com/category/visual-c/'>Visual C++</a> Tagged: <a href='http://vctipsplusplus.wordpress.com/tag/declare_dynamic/'>DECLARE_DYNAMIC</a>, <a href='http://vctipsplusplus.wordpress.com/tag/implement/'>IMPLEMENT</a>, <a href='http://vctipsplusplus.wordpress.com/tag/rtci/'>RTCI</a>, <a href='http://vctipsplusplus.wordpress.com/tag/runtime-class-information/'>Runtime Class Information</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vctipsplusplus.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vctipsplusplus.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vctipsplusplus.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vctipsplusplus.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/219/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/219/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/219/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=219&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2010/04/21/run-time-class-information/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>8.503696 76.952187</georss:point>
		<geo:lat>8.503696</geo:lat>
		<geo:long>76.952187</geo:long>
		<media:content url="http://0.gravatar.com/avatar/6d90dac60288e7ff492767e846063591?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">BijU</media:title>
		</media:content>
	</item>
		<item>
		<title>Search for a file</title>
		<link>http://vctipsplusplus.wordpress.com/2010/03/16/search-for-a-file/</link>
		<comments>http://vctipsplusplus.wordpress.com/2010/03/16/search-for-a-file/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 05:22:06 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[My Readings]]></category>
		<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[Search for a file C++]]></category>
		<category><![CDATA[Search for a file in Environment Variables.]]></category>
		<category><![CDATA[Search for a file in PATH]]></category>
		<category><![CDATA[_searchenv]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=217</guid>
		<description><![CDATA[The _searchenv routine searches for the target file in the specified domain. The varname variable can be any environment or user-defined variable that specifies a list of directory paths, such as PATH, LIB, and INCLUDE. The routine searches first for the file in the current working directory. If it does not find the file, it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=217&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The _searchenv routine searches for the target file in the specified domain. The varname variable can be any environment or user-defined variable that specifies a list of directory paths, such as PATH, LIB, and INCLUDE.</p>
<p>The routine searches first for the file in the current working directory. If  it does not find the file, it looks next through the directories specified by  the environment variable. If the target file is in one of those directories, the  newly created path is copied into pathname. If the  filename file is not found, pathname contains an empty null-terminated string.</p>
<p>(c)MSDN</p>
<br />Filed under: <a href='http://vctipsplusplus.wordpress.com/category/visual-c/my-readings/'>My Readings</a>, <a href='http://vctipsplusplus.wordpress.com/category/visual-c/'>Visual C++</a> Tagged: <a href='http://vctipsplusplus.wordpress.com/tag/search-for-a-file-c/'>Search for a file C++</a>, <a href='http://vctipsplusplus.wordpress.com/tag/search-for-a-file-in-environment-variables/'>Search for a file in Environment Variables.</a>, <a href='http://vctipsplusplus.wordpress.com/tag/search-for-a-file-in-path/'>Search for a file in PATH</a>, <a href='http://vctipsplusplus.wordpress.com/tag/_searchenv/'>_searchenv</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vctipsplusplus.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vctipsplusplus.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vctipsplusplus.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vctipsplusplus.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/217/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=217&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2010/03/16/search-for-a-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>8.503696 76.952187</georss:point>
		<geo:lat>8.503696</geo:lat>
		<geo:long>76.952187</geo:long>
		<media:content url="http://0.gravatar.com/avatar/6d90dac60288e7ff492767e846063591?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">BijU</media:title>
		</media:content>
	</item>
		<item>
		<title>Shell Path Functions&#8230;</title>
		<link>http://vctipsplusplus.wordpress.com/2010/03/02/shell-path-functions/</link>
		<comments>http://vctipsplusplus.wordpress.com/2010/03/02/shell-path-functions/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 06:30:34 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[My Readings]]></category>
		<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[PathAddBackslash]]></category>
		<category><![CDATA[Shell path functions]]></category>
		<category><![CDATA[Windows Shell path handling functions]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=213</guid>
		<description><![CDATA[Gone are the days of my past, Gone are the days of my childhood innocence, Gone are the days of my first and last. Gone are the days of being carefree, Gone are the days of my elation, Gone are the days of my glee. Gone are the days of my fear. Gone are the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=213&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="padding-left:90px;"><em><span style="color:#c0c0c0;"><span style="color:#000000;">Gone are the days</span> of my past,<br />
Gone are the days of my childhood innocence,<br />
Gone are the days of my first and last.<br />
Gone are the days of being carefree,<br />
Gone are the days of my elation,<br />
Gone are the days of my glee.<br />
Gone are the days of my fear.<br />
Gone are the days of savor.<br />
Gone are the days I spent here.</span></em></p>
<p style="padding-left:90px;"><em><span style="color:#c0c0c0;">Gone, Gone, Gone are the days<br />
And I fear<br />
It&#8217;s becoming more <span style="color:#000000;">clear</span>!</span></em></p>
<p>Shell Path Handling functions.. <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>On my career start, I worked a lot with windows folders,files etc..like, creating folder/files,  copying file from one location to another, rename folders/files, verify the given name is a file or folder like that.</p>
<p>For doing such things, at that time, I regularly used the basic file handling functions in MFC or Win32 and most of the processing are done with the very familiar CString class.</p>
<p>By &#8216;processing&#8217; means adding or removing the back slash character, adding the filename at the end of a path name, adding a file extension etc <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now i&#8217;m used with some Shell Path functions.. <a href="http://msdn.microsoft.com/en-us/library/bb773559(VS.85).aspx">http://msdn.microsoft.com/en-us/library/bb773559(VS.85).aspx</a></p>
<p>here are some quite interesting shell functions and their description from MSDS</p>
<ol>
<li>PathAddBackslash- Adds a backslash to the end of a string to create the correct syntax for a path. If the source path already has a trailing backslash, no backslash will be added.</li>
<li>PathCompactPath-Truncates a file path to fit within a given pixel width by replacing path components with ellipses.</li>
<li>PathGetDriveNumber-Searches a path for a drive letter within the range of &#8216;A&#8217; to &#8216;Z&#8217; and returns the corresponding drive number.</li>
<li>PathRemoveExtension-Removes the file extension from a path, if one is present</li>
</ol>
<p>and a lot more.. <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>for VCTips++</p>
<p>BijU</p>
<p><span style="font-size:x-small;"><em><span style="color:#993300;">Contentment is not the fulfillment of what you want, but the realization of how much you already have.</span></em></span></p>
<br />Filed under: <a href='http://vctipsplusplus.wordpress.com/category/visual-c/my-readings/'>My Readings</a>, <a href='http://vctipsplusplus.wordpress.com/category/visual-c/'>Visual C++</a> Tagged: <a href='http://vctipsplusplus.wordpress.com/tag/pathaddbackslash/'>PathAddBackslash</a>, <a href='http://vctipsplusplus.wordpress.com/tag/shell-path-functions/'>Shell path functions</a>, <a href='http://vctipsplusplus.wordpress.com/tag/windows-shell-path-handling-functions/'>Windows Shell path handling functions</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vctipsplusplus.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vctipsplusplus.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vctipsplusplus.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vctipsplusplus.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/213/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=213&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2010/03/02/shell-path-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>8.503696 76.952187</georss:point>
		<geo:lat>8.503696</geo:lat>
		<geo:long>76.952187</geo:long>
		<media:content url="http://0.gravatar.com/avatar/6d90dac60288e7ff492767e846063591?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">BijU</media:title>
		</media:content>
	</item>
		<item>
		<title>Loop Unrolling</title>
		<link>http://vctipsplusplus.wordpress.com/2010/02/24/loop-unrolling/</link>
		<comments>http://vctipsplusplus.wordpress.com/2010/02/24/loop-unrolling/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 08:26:07 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[My Readings]]></category>
		<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[loop unroll]]></category>
		<category><![CDATA[Optimization in C++]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=210</guid>
		<description><![CDATA[Consider the following code: int *buff = new int[3]; for (int i =0; i&#60;3; i++) buff[i] = 0; This loop is inefficient: On every iteration, it assigns a value to the next array element. However,precious CPU time is also wasted on testing the counter and incrementing the counter&#8217;s value and performing a jump statement. To [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=210&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Consider the following code:<br />
int *buff = new int[3];<br />
for (int i =0; i&lt;3; i++)<br />
buff[i] = 0;<br />
This loop is inefficient: <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
On every iteration, it assigns a value to the next array element. However,precious CPU time is also wasted on testing the counter and incrementing the counter&#8217;s value and performing a jump statement. To avoid this overhead, the compiler can <em><strong>unroll the loop</strong></em> into a sequence of three assignment statements, as follows:<br />
buff[0] = 0;<br />
buff[1] = 0;<br />
buff[2] = 0;</p>
<p>for http://vctipsplusplus.wordpress.com/</p>
<p>BijU</p>
<p><strong><span style="color:#ff0000;">If your actions inspire others to dream more, learn more, do more and become  more, you are a leader</span></strong></p>
<br />Filed under: <a href='http://vctipsplusplus.wordpress.com/category/visual-c/my-readings/'>My Readings</a>, <a href='http://vctipsplusplus.wordpress.com/category/visual-c/'>Visual C++</a> Tagged: <a href='http://vctipsplusplus.wordpress.com/tag/loop-unroll/'>loop unroll</a>, <a href='http://vctipsplusplus.wordpress.com/tag/optimization-in-c/'>Optimization in C++</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vctipsplusplus.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vctipsplusplus.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vctipsplusplus.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vctipsplusplus.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/210/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=210&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2010/02/24/loop-unrolling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>8.503696 76.952187</georss:point>
		<geo:lat>8.503696</geo:lat>
		<geo:long>76.952187</geo:long>
		<media:content url="http://0.gravatar.com/avatar/6d90dac60288e7ff492767e846063591?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">BijU</media:title>
		</media:content>
	</item>
		<item>
		<title>ODBC and Visual C++</title>
		<link>http://vctipsplusplus.wordpress.com/2010/02/23/odbc-and-visual-c/</link>
		<comments>http://vctipsplusplus.wordpress.com/2010/02/23/odbc-and-visual-c/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 11:35:20 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[connect string for my sql]]></category>
		<category><![CDATA[Database and MFC]]></category>
		<category><![CDATA[Database and VC++]]></category>
		<category><![CDATA[ODBC and Visual C++]]></category>
		<category><![CDATA[Visual C++ and My SQL]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=204</guid>
		<description><![CDATA[Hi All, The number of  database applications done by using Visual C++ is very less compared to other languages like VB, C#, ASP, Java etc. (Hope you agree with me ). Here I&#8217;m explaining steps for doing a database application using Visual C++/My SQL /ODBC. ODBC is a call-level interface that allows applications to access [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=204&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi All,</p>
<p>The number of  database applications done by using Visual C++ is very less compared to other languages like VB, C#, ASP, Java etc. (Hope you agree with me <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ).</p>
<p>Here I&#8217;m explaining steps for doing a database application using Visual C++/My SQL /ODBC.</p>
<p>ODBC is a call-level interface that allows applications to access data in any database for which there is an ODBC driver. Using ODBC, you can create database applications with access to any database for which your end user has an ODBC driver. ODBC provides an API that allows your application to be independent of the source database management system (DBMS).(C)MSDN</p>
<p><strong>Step 1</strong>. You must include <em>&lt;sqlext.h&gt;</em> and link to <em>ODBC32.LIB</em> When creating an application that uses the ODBC C API.</p>
<p><strong>Step 2</strong>. Establish a connection using a connection string that contains the data source name, user IDs, passwords, and other information required by the data source.</p>
<p>a sample connection string is look like this</p>
<p>DRIVER=MySQL ODBC 5.1 Driver;SERVER=&#8221;localhost&#8221;;PORT=3306;DATABASE=&#8221;MyDataBase&#8221;;UID=&#8221;DBUser&#8221;;PWD=&#8221;DBUserPwd&#8221;;</p>
<p><strong>Step 3</strong>. Allocate the different ODBC handles and set different attributes</p>
<ul>
<li>
<ul>
<li>Allocate the ODBC environment by SQL_HANDLE_ENV using the       method <em>SQLAllocHandle</em>()</li>
<li>Set the ODBC version environment attribute using <em>SQLSetEnvAttr</em>()
<ul>
<li>for eg: SQLSetEnvAttr( m_hSqlEnv, SQL_ATTR_ODBC_VERSION,        (void*) SQL_OV_ODBC3, 0 );</li>
</ul>
</li>
<li>Allocate the connection handle by SQL_HANDLE_DBC using the method <em>SQLAllocHandle</em>()</li>
</ul>
</li>
</ul>
<p><strong>Step 4</strong>. Connect to the data source by using the connection string and method <em>SQLDriverConnect</em>()</p>
<p>Now you established a connection with the database. <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now, we are trying to retrieve the data.</p>
<p><strong>Step 5</strong>. Allocate the ODBC statement handles by SQL_HANDLE_STMT</p>
<p><strong>Step 6</strong>. Execute the prepared statement using <em>SQLExecDirect</em>()</p>
<p style="padding-left:30px;">for eg: SQLExecDirect(m_hSqlStmt, (SQLTCHAR*)szQuery, SQL_NTS)</p>
<ul>
<li>Some Tips :
<ul>
<li>You can get the number of COLUMNS in the result set using the method        SQLNumResultCols()</li>
<li>also the number of ROWS by using SQLRowCount()</li>
</ul>
</li>
</ul>
<p><strong>Step 7</strong>.  Fetch the data result set using <em>SQLFetch</em>()</p>
<p><strong>Step 8</strong>. Read the data using <em>SQLGetData</em>();</p>
<ul>
<li>
<ul>
<li>for eg: SQLGetData(m_hSqlStmt, 1, SQL_C_TCHAR, m_szName, 255,       &amp;cbName);</li>
</ul>
</li>
</ul>
<p><strong>Step 9</strong>. Close the Connection using <em>SQLDisconnect</em>() and then free the different allocated handles using<em>SQLFreeHandle</em>().</p>
<p>For vctipsplusplus,</p>
<p>BijU..</p>
<p>To acquire knowledge, one must study; but to acquire wisdom, one must observe</p>
<br />Filed under: <a href='http://vctipsplusplus.wordpress.com/category/visual-c/'>Visual C++</a> Tagged: <a href='http://vctipsplusplus.wordpress.com/tag/connect-string-for-my-sql/'>connect string for my sql</a>, <a href='http://vctipsplusplus.wordpress.com/tag/database-and-mfc/'>Database and MFC</a>, <a href='http://vctipsplusplus.wordpress.com/tag/database-and-vc/'>Database and VC++</a>, <a href='http://vctipsplusplus.wordpress.com/tag/odbc-and-visual-c/'>ODBC and Visual C++</a>, <a href='http://vctipsplusplus.wordpress.com/tag/visual-c-and-my-sql/'>Visual C++ and My SQL</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vctipsplusplus.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vctipsplusplus.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vctipsplusplus.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vctipsplusplus.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/204/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=204&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2010/02/23/odbc-and-visual-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d90dac60288e7ff492767e846063591?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">BijU</media:title>
		</media:content>
	</item>
		<item>
		<title>Implementing COM Interface</title>
		<link>http://vctipsplusplus.wordpress.com/2010/02/18/implementing-com-interface/</link>
		<comments>http://vctipsplusplus.wordpress.com/2010/02/18/implementing-com-interface/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 05:55:19 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[How To Know]]></category>
		<category><![CDATA[My Readings]]></category>
		<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[Implementing COM Interface]]></category>
		<category><![CDATA[my reading]]></category>
		<category><![CDATA[vctips]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=198</guid>
		<description><![CDATA[Implementing a COM interface means that the object uses code that implements each method of the interface and provides COM binary-compliant pointers to those functions to the COM library. COM then makes those functions available to any client who asks for a pointer to the interface, whether the client is inside or outside of the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=198&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Implementing a COM interface means that the object uses code that implements each method of the interface and provides COM binary-compliant pointers to those functions to the COM library. COM then makes those functions available to any client who asks for a pointer to the interface, whether the client is inside or outside of the process that implements those functions.</p>
<br />Filed under: <a href='http://vctipsplusplus.wordpress.com/category/visual-c/how-to-know/'>How To Know</a>, <a href='http://vctipsplusplus.wordpress.com/category/visual-c/my-readings/'>My Readings</a>, <a href='http://vctipsplusplus.wordpress.com/category/visual-c/'>Visual C++</a> Tagged: <a href='http://vctipsplusplus.wordpress.com/tag/implementing-com-interface/'>Implementing COM Interface</a>, <a href='http://vctipsplusplus.wordpress.com/tag/my-reading/'>my reading</a>, <a href='http://vctipsplusplus.wordpress.com/tag/vctips/'>vctips</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/198/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/198/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/198/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/198/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vctipsplusplus.wordpress.com/198/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vctipsplusplus.wordpress.com/198/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vctipsplusplus.wordpress.com/198/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vctipsplusplus.wordpress.com/198/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/198/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/198/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/198/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/198/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/198/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/198/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=198&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2010/02/18/implementing-com-interface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d90dac60288e7ff492767e846063591?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">BijU</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows Privileges Issues !!</title>
		<link>http://vctipsplusplus.wordpress.com/2009/10/21/windows-privileges-issues/</link>
		<comments>http://vctipsplusplus.wordpress.com/2009/10/21/windows-privileges-issues/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 04:46:29 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[AdjustTokenPrivileges]]></category>
		<category><![CDATA[ERROR_NOT_ALL_ASSIGNED]]></category>
		<category><![CDATA[GetLastError returns ERROR_INVALID_PARAMETER]]></category>
		<category><![CDATA[LookupPrivilegeValue]]></category>
		<category><![CDATA[OpenProcessToken]]></category>
		<category><![CDATA[Project Settings > Linker > Manifest File.]]></category>
		<category><![CDATA[requireAdministrator]]></category>
		<category><![CDATA[SetSystemTime failure]]></category>
		<category><![CDATA[SetSytemTime]]></category>
		<category><![CDATA[SE_SYSTEMTIME_NAME]]></category>
		<category><![CDATA[SYSTEMTIME]]></category>
		<category><![CDATA[User Access Control]]></category>
		<category><![CDATA[Windows 7 systemtime]]></category>
		<category><![CDATA[Windows Privileges Issues]]></category>
		<category><![CDATA[Windows Vista SetSystemTime]]></category>
		<category><![CDATA[Windows Vista systemtime]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=190</guid>
		<description><![CDATA[A very interesting tip.. For my current project, I need to set the system time with some reference time. Quite easy!!. The SetSytemTime (). The syntax is like this BOOL WINAPI SetSystemTime( __in          const SYSTEMTIME* lpSystemTime ); The time must be in the form of SYSTEMTIME struct.  And I implement it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=190&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">A very interesting tip..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">For my current project, I need to set the system time with some reference time. Quite easy!!. The SetSytemTime (). The syntax is like this</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">BOOL WINAPI SetSystemTime(</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">__in          const SYSTEMTIME* lpSystemTime</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">The time must be in the form of SYSTEMTIME struct.  And I implement it in my code as</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">SYSTEMTIME st = NewTime;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">bSuccess = SetSystemTime(&amp;st);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"> <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . The problem is on the way.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">The SetSystemTime function enables the SE_SYSTEMTIME_NAME privilege before changing the system time. This privilege is disabled by default. (©MSDN)</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">for changing the privileges, we need to implement some authorization functions. In the following order</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">1-  OpenProcessToken() &#8211; opens the access token associated with a process</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">2-  LookupPrivilegeValue() &#8211; Retrieves the locally unique identifier (LUID) used on a specified system to locally represent the specified privilege name</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">3-   AdjustTokenPrivileges()-enables or disables privileges in the specified access token.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">After that, change the system time with SetSystemTime() method.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Then again reset the privileges by using the function AdjustTokenPrivileges().</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">It works well in WindowsXP. No problems for setting the new time.  J</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">But , the problem comes from Windows 7 and Windows Vista.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Then, I start debugging my code in Windows 7. All authorization functions works fine for me.  Like OpenProcessToken(),LookupPrivilegeValue() and AdjustTokenPrivileges(). But I felt something bad about the execution of the last method. AdjustTokenPrivileges()..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">I checked the GetLastError() return value. Instead of ERROR_SUCCESS</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">, it returns ERROR_NOT_ALL_ASSIGNED J</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">So my investigation is now in that way. How to handle that? Its all because of UAC (User Access Control) problems. Because the SE_SYSTEMTIME_NAME require administrative privilege.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">My colleague gave me a tip about Manifests.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">The description from MSDN is like Manifests are XML files that accompany and describe side-by-side assemblies or isolated applications. Manifests uniquely identify the assembly through the assembly&#8217;s &lt;assemblyIdentity&gt; element. They contain information used for binding and activation, such as COM classes, interfaces, and type libraries, that has traditionally been stored in the registry. Manifests also specify the files that make up the assembly and may include Windows classes if the assembly author wants them to be versioned. Side-by-side assemblies are not registered on the system, but are available to applications and other assemblies on the system that specify dependencies in manifest files.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Manifest files enable administrators and applications to manage side-by-side assembly versions after deployment. Every side-by-side assembly must have a manifest associated with it. The installation of Windows XP installs the supported Microsoft side-by-side assemblies with their manifests. If you develop your own side-by-side assemblies, you must also install manifest files</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">I turn on the manifests for my application also. Its very simple.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Project Settings &gt; Linker &gt; Manifest File.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">And make the options as indicated in the figure.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Including manifest for project</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">The Rebuild All  and Execute..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;"> <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">for http://vctipsplusplus.wordpress.com/</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">BijU</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Gravity is not responsible for people to fall in love. It just happens.</div>
<p>A very interesting tip..</p>
<p>For my current project, I need to set the system time with some reference time. Quite easy!!. Using SetSytemTime (). The syntax is like this</p>
<blockquote><p>BOOL WINAPI SetSystemTime(</p>
<p>__in          const SYSTEMTIME* lpSystemTime</p>
<p>);</p></blockquote>
<p>The time must be in the form of SYSTEMTIME struct.  And I implement it in my code as</p>
<blockquote><p>SYSTEMTIME st = NewTime;</p>
<p>bSuccess = SetSystemTime(&amp;st);</p></blockquote>
<p> <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . The problem is on the way.</p>
<p>The <strong>SetSystemTime </strong>function enables the <strong>SE_SYSTEMTIME_NAME </strong>privilege before changing the system time. This privilege is disabled by default. (©MSDN)</p>
<p>for changing the privileges, we need to implement some authorization functions. In the following order</p>
<blockquote><p>1-  OpenProcessToken() &#8211; opens the access token associated with a process</p>
<p>2-  LookupPrivilegeValue() &#8211; Retrieves the locally unique identifier (LUID) used on a specified system to locally represent the specified privilege name</p>
<p>3-   AdjustTokenPrivileges()-enables or disables privileges in the specified access token.</p></blockquote>
<p>After that, change the system time with <strong>SetSystemTime</strong>() method.</p>
<p>Then again reset the privileges by using the function <strong>AdjustTokenPrivileges</strong>().</p>
<p>It works well in WindowsXP. No problems for setting the new time.  :) But , the problem comes from Windows 7 and Windows Vista.</p>
<p>Then, I start debugging my code in Windows 7. All authorization functions works fine for me.  Like <strong>OpenProcessToken</strong>(),<strong>LookupPrivilegeValue</strong>() and <strong>AdjustTokenPrivileges</strong>(). But I felt something bad about the execution of the last method. <strong>AdjustTokenPrivileges</strong>()..</p>
<p>I checked the GetLastError() return value. Instead of ERROR_SUCCESS, it returns <strong>ERROR_NOT_ALL_ASSIGNED </strong>J</p>
<p>So my investigation is now in that way. How to handle that? Its all because of UAC (User Access Control) problems. Because the SE_SYSTEMTIME_NAME require administrative privilege.</p>
<p>My colleague gave me a tip about Manifests.</p>
<blockquote><p>The description from MSDN is like Manifests are XML files that accompany and describe side-by-side assemblies or isolated applications. Manifests uniquely identify the assembly through the assembly&#8217;s &lt;assemblyIdentity&gt; element. They contain information used for binding and activation, such as COM classes, interfaces, and type libraries, that has traditionally been stored in the registry. Manifests also specify the files that make up the assembly and may include Windows classes if the assembly author wants them to be versioned. Side-by-side assemblies are not registered on the system, but are available to applications and other assemblies on the system that specify dependencies in manifest files.</p>
<p>Manifest files enable administrators and applications to manage side-by-side assembly versions after deployment. Every side-by-side assembly must have a manifest associated with it. The installation of Windows XP installs the supported Microsoft side-by-side assemblies with their manifests. If you develop your own side-by-side assemblies, you must also install manifest files</p></blockquote>
<pre><span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;line-height:19px;white-space:normal;font-size:13px;">I turn on the manifests for my application also. Its very simple.</span></pre>
<p>Project Settings &gt; Linker &gt; Manifest File. And make the options as indicated in the figure.</p>
<div id="attachment_196" class="wp-caption aligncenter" style="width: 610px"><img class="size-full wp-image-196" title=" Manifest" src="http://vctipsplusplus.files.wordpress.com/2009/10/12.png?w=600&#038;h=417" alt="Project Settings&gt;Linker Options &gt; Manifest" width="600" height="417" /><p class="wp-caption-text">Project Settings&gt;Linker Options &gt; Manifest</p></div>
<p>Including manifest for project</p>
<p>The Rebuild All  and Execute..</p>
<p> <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>for http://vctipsplusplus.wordpress.com/</p>
<p>BijU</p>
<p><strong><span style="color:#ff0000;">Gravity is not responsible for people to fall in love. It just happens.</span></strong></p>
<br />Posted in Visual C++ Tagged: AdjustTokenPrivileges, ERROR_NOT_ALL_ASSIGNED, GetLastError returns ERROR_INVALID_PARAMETER, LookupPrivilegeValue, OpenProcessToken, Project Settings &gt; Linker &gt; Manifest File., requireAdministrator, SetSystemTime failure, SetSytemTime, SE_SYSTEMTIME_NAME, SYSTEMTIME, User Access Control, Windows 7 systemtime, Windows Privileges Issues, Windows Vista SetSystemTime, Windows Vista systemtime <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vctipsplusplus.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vctipsplusplus.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vctipsplusplus.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vctipsplusplus.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/190/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=190&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2009/10/21/windows-privileges-issues/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d90dac60288e7ff492767e846063591?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">BijU</media:title>
		</media:content>

		<media:content url="http://vctipsplusplus.files.wordpress.com/2009/10/12.png" medium="image">
			<media:title type="html"> Manifest</media:title>
		</media:content>
	</item>
		<item>
		<title>Environment Varaibles using VC++</title>
		<link>http://vctipsplusplus.wordpress.com/2009/10/20/environment-varaibles-using-vc/</link>
		<comments>http://vctipsplusplus.wordpress.com/2009/10/20/environment-varaibles-using-vc/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 05:58:05 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[%MSDevDir%]]></category>
		<category><![CDATA[Environment Varaibles]]></category>
		<category><![CDATA[Environment Varaibles using VC++]]></category>
		<category><![CDATA[Environment Varaibles Winodws]]></category>
		<category><![CDATA[ExpandEnvironmentStrings]]></category>
		<category><![CDATA[ExpandEnvironmentStringsForUser]]></category>
		<category><![CDATA[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Control\ Session Manager\ Environment]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=183</guid>
		<description><![CDATA[Environment variable are variables that can be available to all running programs.  You can access the environment variables using Control Panel &#62; System &#62; Advanced &#62; Environment Variables (Lot of other methods are also available ) In Windows Registry, you can locate them on HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Control\ Session Manager\ Environment. Some of the Environment Variables are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=183&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Environment variable are variables that can be available to all running programs.  You can access the environment variables using C<strong>ontrol Panel &gt; System &gt; Advanced &gt; Environment Variables</strong> (Lot of other methods are also available <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<div id="attachment_181" class="wp-caption aligncenter" style="width: 429px"><img class="size-full wp-image-181" title="Environment Variables" src="http://vctipsplusplus.files.wordpress.com/2009/10/env11.png?w=419&#038;h=486" alt="Environment Variables" width="419" height="486" /><p class="wp-caption-text">Environment Variables</p></div>
<div id="attachment_182" class="wp-caption aligncenter" style="width: 394px"><img class="size-full wp-image-182 " title="Environment Variables @ BIJU" src="http://vctipsplusplus.files.wordpress.com/2009/10/env2.png?w=384&#038;h=430" alt="Environment Variables" width="384" height="430" /><p class="wp-caption-text">Environment Variables</p></div>
<p>In Windows Registry, you can locate them on <strong>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Control\ Session Manager\ Environment</strong>.</p>
<p>Some of the Environment Variables are TEMP, TMP, OS etc.</p>
<p>A number of situations may come during the coding phase to access those variables. For eg: getting the temp folder name, system folder name, lib path, include path etc.</p>
<p>We can access those items from environment variables using the following commands.</p>
<p>ExpandEnvironmentStrings()  - function expands environment-variable strings and replaces them with their defined values.</p>
<p>and ExpandEnvironmentStringsForUser()-function expands the source string by using the environment block established for the specified user.</p>
<p>Like this</p>
<blockquote><p>CString strErrorMsg = _T(&#8220;&#8221;);</p>
<p>TCHAR szEnvPath[MAX_PATH];</p>
<p>DWORD dwLen = 0;</p>
<p>dwLen = ::ExpandEnvironmentStrings( _T(&#8220;%MSDevDir%&#8221;), szEnvPath, MAX_PATH );</p>
<p>if( 0 == dwLen)</p>
<p>{</p>
<p>// ExpandEnvironmentStrings() failed</p>
<p>strErrorMsg = _T(&#8220;Cannot Expand using ExpandEnvironmentStrings()&#8221;);</p>
<p>}</p></blockquote>
<p>Now the value for the MSDevDir is in the szEnvPath variable. <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="line-height:1.6em;margin:.7em 0;padding:0;">for <a style="color:#265e15;text-decoration:none;border-bottom-color:#996633;border-bottom-width:1px;border-bottom-style:dashed;margin:0;padding:0;" title="http://vctipsplusplus.wordpress.com/" href="http://vctipsplusplus.wordpress.com/">http://vctipsplusplus.wordpress.com/</a></p>
<p style="line-height:1.6em;margin:.7em 0;padding:0;">BijU</p>
<p style="line-height:1.6em;margin:.7em 0;padding:0;"><span style="color:#ff0000;"><strong>Every day you waste is one you can never make up</strong></span></p>
<br />Posted in Visual C++ Tagged: %MSDevDir%, Environment Varaibles, Environment Varaibles using VC++, Environment Varaibles Winodws, ExpandEnvironmentStrings, ExpandEnvironmentStringsForUser, HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Control\ Session Manager\ Environment <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vctipsplusplus.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vctipsplusplus.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vctipsplusplus.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vctipsplusplus.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/183/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=183&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2009/10/20/environment-varaibles-using-vc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d90dac60288e7ff492767e846063591?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">BijU</media:title>
		</media:content>

		<media:content url="http://vctipsplusplus.files.wordpress.com/2009/10/env11.png" medium="image">
			<media:title type="html">Environment Variables</media:title>
		</media:content>

		<media:content url="http://vctipsplusplus.files.wordpress.com/2009/10/env2.png" medium="image">
			<media:title type="html">Environment Variables @ BIJU</media:title>
		</media:content>
	</item>
		<item>
		<title>Turn Off your Monitor Display !!</title>
		<link>http://vctipsplusplus.wordpress.com/2009/10/15/turn-onoff-your-monitor-display/</link>
		<comments>http://vctipsplusplus.wordpress.com/2009/10/15/turn-onoff-your-monitor-display/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 04:45:48 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[ON Monitor VC++]]></category>
		<category><![CDATA[on/off monitor]]></category>
		<category><![CDATA[SC_MONITORPOWER]]></category>
		<category><![CDATA[Shut down the monitor]]></category>
		<category><![CDATA[the display is being shut off]]></category>
		<category><![CDATA[turn on/off monitor]]></category>
		<category><![CDATA[turn on/off monitor C++]]></category>
		<category><![CDATA[Win32_DesktopMonitor]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=173</guid>
		<description><![CDATA[Image Source: http://thumbs.dreamstime.com/thumb_76/1154983417etR5O8.jpg Nowadays, I&#8217;m experimenting with some hardware and Windows .I’m very happy to work with this. Because, after a lot of reading and googling, doing some coding. Then again, reading a lot of documents A very interesting thing in doing this type of coding is that, we don’t get  much information from MSDN [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=173&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://thumbs.dreamstime.com/thumb_76/1154983417etR5O8.jpg"><img class="size-medium wp-image-174" title="On Off" src="http://vctipsplusplus.files.wordpress.com/2009/10/1154983417etr5o8.jpg?w=270&#038;h=300" alt="On Off Switch" width="270" height="300" /></a></p>
<p style="text-align:center;"><strong><em><span style="color:#808080;">Image Source: </span></em><a href="http://thumbs.dreamstime.com/thumb_76/1154983417etR5O8.jpg"><em><span style="color:#808080;">http://thumbs.dreamstime.com/thumb_76/1154983417etR5O8.jpg</span></em></a></strong></p>
<p>Nowadays, I&#8217;m experimenting with some hardware and Windows <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .I’m very happy to work with this. Because, after a lot of reading and googling, doing some coding. Then again, reading a lot of documents <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>A very interesting thing in doing this type of coding is that, we don’t get  much information from MSDN <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> . Almost all information is available in the MSDN, but it’s up to you to find the best algorithm/class/technology that fit for you.</p>
<p>Yesterday, I tried a lot to get the information from our Desktop Monitor. My aim was to ON/OFF our Desktop Monitor. I have hands on experience with WMI (Windows Management Instrumentation) to query the details like motherboard, disks, Operating System etc. With that confidence I first look into the Win32_DesktopMonitor. And in that a method named SetPowerState() is available. And the information about that method give me immense pleasure.</p>
<p>Its like “The SetPowerState method sets the desired power state for a logical device and when a device should be put into that state. And the power state may have the following values, like(from MSDN)</p>
<table border="0" cellspacing="0" cellpadding="0" width="90%">
<tbody>
<tr>
<td width="40%" valign="top">1</td>
<td width="60%" valign="top">Full power.</td>
</tr>
<tr>
<td width="40%" valign="top">2</td>
<td width="60%" valign="top">Power save — low-power mode.</td>
</tr>
<tr>
<td width="40%" valign="top">3</td>
<td width="60%" valign="top">Power save — standby.</td>
</tr>
<tr>
<td width="40%" valign="top">4</td>
<td width="60%" valign="top">Power save — other.</td>
</tr>
<tr>
<td width="40%" valign="top">5</td>
<td width="60%" valign="top">Power cycle.</td>
</tr>
<tr>
<td width="40%" valign="top">6</td>
<td width="60%" valign="top">Power off.</td>
</tr>
</tbody>
</table>
<table border="1" cellspacing="0" cellpadding="0" width="90%">
<tbody></tbody>
</table>
<p>I’m very happy after reading this document.  Unfortunately, its not implemented by windows. Due to a lot of technical problems.</p>
<p>So..</p>
<p>But using the very common message like SendMessage can solve the problem so easily.</p>
<p>Just copy the below statement and execute..</p>
<blockquote><p>SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM)2);</p></blockquote>
<p>Hope you are familiar with first 2 params. Documentation from the  MSDN for the 3<sup>rd</sup> param is</p>
<table border="0" cellpadding="0">
<tbody>
<tr>
<td width="42%" valign="top">SC_MONITORPOWER</td>
<td width="58%" valign="top">Sets   the state of the display. This command supports devices that have   power-saving features, such as a battery-powered personal computer.</td>
</tr>
</tbody>
</table>
<blockquote><p>And the 4<sup>th</sup> param may take the values like</p>
<p>-1 – the display is being on</p>
<p>1 &#8211; the display is going to low power</p>
<p>2 &#8211; the display is being shut off</p></blockquote>
<p>I think it is so simple. Thanks to Microsoft.. <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="line-height:1.6em;margin:.7em 0;padding:0;">for <a style="color:#265e15;text-decoration:none;border-bottom-color:#996633;border-bottom-width:1px;border-bottom-style:dashed;margin:0;padding:0;" title="http://vctipsplusplus.wordpress.com/" href="http://vctipsplusplus.wordpress.com/">http://vctipsplusplus.wordpress.com/</a></p>
<p style="line-height:1.6em;margin:.7em 0;padding:0;">BijU</p>
<p style="line-height:1.6em;margin:.7em 0;padding:0;"><span style="font-size:x-small;"><span style="font-size:10pt;"><span style="color:#ff0000;"><strong>God won’t ask about the fancy clothes in your wardrobe, but will ask how many of  those clothes helped the needy.</strong></span></span></span></p>
<br />Posted in Visual C++ Tagged: ON Monitor VC++, on/off monitor, SC_MONITORPOWER, Shut down the monitor, the display is being shut off, turn on/off monitor, turn on/off monitor C++, Win32_DesktopMonitor <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vctipsplusplus.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vctipsplusplus.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vctipsplusplus.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vctipsplusplus.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/173/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&amp;blog=3506930&amp;post=173&amp;subd=vctipsplusplus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2009/10/15/turn-onoff-your-monitor-display/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6d90dac60288e7ff492767e846063591?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">BijU</media:title>
		</media:content>

		<media:content url="http://vctipsplusplus.files.wordpress.com/2009/10/1154983417etr5o8.jpg?w=270" medium="image">
			<media:title type="html">On Off</media:title>
		</media:content>
	</item>
	</channel>
</rss>
