<?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: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>Wed, 21 Oct 2009 05:03:49 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='vctipsplusplus.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/0851e26db52f1b74feea0801d8695812?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>VC Tips++</title>
		<link>http://vctipsplusplus.wordpress.com</link>
	</image>
			<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 in my code as
SYSTEMTIME st [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=190&subd=vctipsplusplus&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><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://s.wordpress.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://s.wordpress.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://s.wordpress.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://s.wordpress.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>
 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/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&blog=3506930&post=190&subd=vctipsplusplus&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2009/10/21/windows-privileges-issues/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/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&blog=3506930&post=183&subd=vctipsplusplus&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><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://s.wordpress.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://s.wordpress.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>
 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/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&blog=3506930&post=183&subd=vctipsplusplus&ref=&feed=1" /></div>]]></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 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=173&subd=vctipsplusplus&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><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://s.wordpress.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://s.wordpress.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://s.wordpress.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://s.wordpress.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>
 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/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&blog=3506930&post=173&subd=vctipsplusplus&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2009/10/15/turn-onoff-your-monitor-display/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/1154983417etr5o8.jpg?w=270" medium="image">
			<media:title type="html">On Off</media:title>
		</media:content>
	</item>
		<item>
		<title>String Conversion..</title>
		<link>http://vctipsplusplus.wordpress.com/2009/08/12/string-conversion/</link>
		<comments>http://vctipsplusplus.wordpress.com/2009/08/12/string-conversion/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 12:51:05 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[ATL macros]]></category>
		<category><![CDATA[String Conversion]]></category>
		<category><![CDATA[UNICODE to ANSI]]></category>
		<category><![CDATA[wcstombs()]]></category>
		<category><![CDATA[wcstombs() example]]></category>
		<category><![CDATA[WideCharToMultiByte eg:]]></category>
		<category><![CDATA[WideCharToMultiByte example]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=165</guid>
		<description><![CDATA[A very nice section under windows programming..
Every windows programmer may deals with UNICODE, ANSI like character encoding schemes..
And also, the conversion from Unicode to ANSI and vice versa..
Now I collect some stuffs for you..
Converting UNICODE string to ANSI strings..
You can convert a Unicode string to an ANSI string with the WideCharToMultiByte() API
The syntax is
int WideCharToMultiByte(
UINT [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=165&subd=vctipsplusplus&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">A very nice section under windows programming..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Every windows programmer may deals with UNICODE, ANSI like character encoding schemes..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">And also, the conversion from Unicode to ANSI and vice versa..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Now I collect some stuffs for you..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Converting UNICODE string to ANSI strings..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">You can convert a Unicode string to an ANSI string with the WideCharToMultiByte() API</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">The syntax is</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">int WideCharToMultiByte(</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">UINT CodePage,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">DWORD dwFlags,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">LPCWSTR lpWideCharStr,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">int cchWideChar,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">LPSTR lpMultiByteStr,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">int cbMultiByte,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">LPCSTR lpDefaultChar,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">LPBOOL lpUsedDefaultChar</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">For example, we have our UNICODE string in wszUNICODEString, we want to convert that to ANSI string szANSIString.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">char szANSIString [MAX_PATH];</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">WideCharToMultiByte ( CP_ACP,                // ANSI code page</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">WC_COMPOSITECHECK,     // Check for accented characters</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">wszUNICODEString,         // Source Unicode string</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">-1,                    // -1 means string is zero-terminated</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">szANSIString,          // Destination char string</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">sizeof(szANSIString),  // Size of buffer</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">NULL,                  // No default character</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">NULL );                // Don&#8217;t care about this flag</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">wcstombs()</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Converts a sequence of wide characters to a corresponding sequence of multibyte characters.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Syntax is just</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">size_t wcstombs_s(</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">char *mbstr,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">const wchar_t *wcstr,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">size_t count</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">For eg:  wcstombs_s ( szANSIString, wszUNICODEString, sizeof(szANSIString) );</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">CString</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Using CString class’s constructors and assignment  operators, we can convert UNICODE string to ANSI string.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Using constructor</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">CString strANSI_1 (wszUNICODEString);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Using Assignment Operator</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">CString strANSI_2;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">strANSI_2 = wszUNICODEString;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">ATL macros</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">To convert a Unicode string to ANSI, use the W2A() macro</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">#include &lt;atlconv.h&gt;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">….</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">{</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">char szANSIString [MAX_PATH];</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">USES_CONVERSION;  // DeclareA very nice section under windows programming..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Every windows programmer may deals with UNICODE, ANSI like character encoding schemes..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">And also, the conversion from Unicode to ANSI and vice versa..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Now I collect some stuffs for you..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Converting UNICODE string to ANSI strings..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">You can convert a Unicode string to an ANSI string with the WideCharToMultiByte() API</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">The syntax is</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">int WideCharToMultiByte(</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">UINT CodePage,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">DWORD dwFlags,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">LPCWSTR lpWideCharStr,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">int cchWideChar,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">LPSTR lpMultiByteStr,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">int cbMultiByte,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">LPCSTR lpDefaultChar,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">LPBOOL lpUsedDefaultChar</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">For example, we have our UNICODE string in wszUNICODEString, we want to convert that to ANSI string szANSIString.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">char szANSIString [MAX_PATH];</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">WideCharToMultiByte ( CP_ACP,                // ANSI code page</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">WC_COMPOSITECHECK,     // Check for accented characters</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">wszUNICODEString,         // Source Unicode string</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">-1,                    // -1 means string is zero-terminated</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">szANSIString,          // Destination char string</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">sizeof(szANSIString),  // Size of buffer</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">NULL,                  // No default character</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">NULL );                // Don&#8217;t care about this flag</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">wcstombs()</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Converts a sequence of wide characters to a corresponding sequence of multibyte characters.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Syntax is just</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">size_t wcstombs_s(</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">char *mbstr,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">const wchar_t *wcstr,</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">size_t count</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">For eg:  wcstombs_s ( szANSIString, wszUNICODEString, sizeof(szANSIString) );</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">CString</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Using CString class’s constructors and assignment  operators, we can convert UNICODE string to ANSI string.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Using constructor</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">CString strANSI_1 (wszUNICODEString);</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">Using Assignment Operator</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">CString strANSI_2;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">strANSI_2 = wszUNICODEString;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">ATL macros</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">To convert a Unicode string to ANSI, use the W2A() macro</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">#include &lt;atlconv.h&gt;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">….</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">{</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">char szANSIString [MAX_PATH];</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">USES_CONVERSION;  // Declare local variable used by the macros.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">lstrcpy ( szANSIString, W2A (wszUNICODEString) );</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;"></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">For every coin there is an another side also..</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">local variable used by the macros.</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">lstrcpy ( szANSIString, W2A (wszUNICODEString) );</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">}</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;"></div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:421px;width:1px;height:1px;">For every coin there is an another side also..</div>
<p>A very nice section under windows programming..</p>
<p>Every windows programmer may deals with UNICODE, ANSI like character encoding schemes..</p>
<p>And also, the conversion from Unicode to ANSI and vice versa..</p>
<p>Now I collect some stuffs for you..</p>
<p><strong><span style="text-decoration:underline;">Converting UNICODE string to ANSI strings..</span></strong></p>
<p>You can convert a Unicode string to an ANSI string with the WideCharToMultiByte() API</p>
<p>The syntax is</p>
<pre>int WideCharToMultiByte(
  UINT CodePage, 
  DWORD dwFlags, 
  LPCWSTR lpWideCharStr,
  int cchWideChar, 
  LPSTR lpMultiByteStr, 
  int cbMultiByte,
  LPCSTR lpDefaultChar,    
  LPBOOL lpUsedDefaultChar
);</pre>
<p>For example, we have our UNICODE string in wszUNICODEString, we want to convert that to ANSI string szANSIString.</p>
<pre>char szANSIString [MAX_PATH];
 WideCharToMultiByte ( CP_ACP,                // ANSI code page
                          WC_COMPOSITECHECK,     // Check for accented characters
                          wszUNICODEString,         // Source Unicode string
                          -1,                    // -1 means string is zero-terminated
                          szANSIString,          // Destination char string
                          sizeof(szANSIString),  // Size of buffer
                          NULL,                  // No default character
                          NULL );                // Don't care about this flag</pre>
<p><strong><span style="text-decoration:underline;">wcstombs()</span></strong></p>
<p>Converts a sequence of wide characters to a corresponding sequence of multibyte characters.</p>
<p>Syntax is just</p>
<pre>size_t wcstombs_s(
   char *mbstr,
   const wchar_t *wcstr,
   size_t count 
);</pre>
<p>For eg:</p>
<pre> wcstombs_s ( szANSIString, wszUNICODEString, sizeof(szANSIString) );</pre>
<p><strong><span style="text-decoration:underline;">CString</span></strong></p>
<p>Using CString class’s constructors and assignment  operators, we can convert UNICODE string to ANSI string.</p>
<p>Using constructor:</p>
<pre>CString strANSI_1 (wszUNICODEString);</pre>
<p>Using Assignment Operator</p>
<pre>CString strANSI_2;
strANSI_2 = wszUNICODEString;</pre>
<p><strong><span style="text-decoration:underline;">ATL macros</span></strong></p>
<p>To convert a Unicode string to ANSI, use the W2A() macro</p>
<pre>#include &lt;atlconv.h&gt;
….
{
char szANSIString [MAX_PATH];
USES_CONVERSION;  // Declare local variable used by the macros.
    lstrcpy ( szANSIString, W2A (wszUNICODEString) );
}</pre>
<p><span style="font-family:verdana;color:#333333;font-size:12px;"> </span></p>
<p style="line-height:1.6em;margin:.7em 0;padding:0;">for <a style="text-decoration:none;color:#265e15;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><span style="font-family:'Franklin Gothic Medium',sans-serif;color:#c20000;font-size:10pt;"><strong><span style="color:#ff0000;">Make the best of lifes moments !!</span></strong></span></p>
<p><strong><span style="color:#ff0000;">What really matters at the end of  the day is if you made the best use of time,<br />
and done everything that  you needed to do.</span></strong></p>
<p><strong><span style="color:#ff0000;">Don&#8217;t sit just there waiting, You only live  once!</span></strong><span style="font-family:Verdana,sans-serif;font-size:10pt;"><br />
</span></p>
 Tagged: ATL macros, String Conversion, UNICODE to ANSI, wcstombs(), wcstombs() example, WideCharToMultiByte eg:, WideCharToMultiByte example <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/165/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=165&subd=vctipsplusplus&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2009/08/12/string-conversion/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>
	</item>
		<item>
		<title>How To Know the MFC version you are using..</title>
		<link>http://vctipsplusplus.wordpress.com/2009/07/14/how-to-know-the-mfc-version-you-are-using/</link>
		<comments>http://vctipsplusplus.wordpress.com/2009/07/14/how-to-know-the-mfc-version-you-are-using/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 04:39:56 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[How To Know]]></category>
		<category><![CDATA[how to know the mfc version]]></category>
		<category><![CDATA[MFC version]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=155</guid>
		<description><![CDATA[Hi all,
Do you know, how to get  information about, the MFC version we are using?
Please follow these steps:
1. Locate the file afxver_.h (It is in the folder  &#8221;include&#8221;)
2. Check the value of symbolic constant  _MFC_VER
3.   That value is the MFC version number&#8230;
for eg:
#define _MFC_VER 0&#215;0800 // Microsoft Foundation Classes version 8.00

 
for http://vctipsplusplus.wordpress.com/
BijU
When you&#8217;re [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=155&subd=vctipsplusplus&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hi all,</p>
<p>Do you know, how to get  information about, the MFC version we are using?</p>
<p>Please follow these steps:</p>
<p>1. Locate the file <strong>afxver_.h </strong>(It is in the folder  &#8221;include&#8221;)</p>
<p>2. Check the value of symbolic constant  _MFC_VER</p>
<p>3. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  That value is the MFC version number&#8230;</p>
<p>for eg:</p>
<p>#define _MFC_VER 0&#215;0800 // Microsoft Foundation Classes version 8.00</p>
<dt></dt>
<dt> </dt>
<p style="line-height:1.6em;margin:.7em 0;padding:0;">for <a style="text-decoration:none;color:#265e15;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-family:'Lucida Sans Unicode';color:#008000;font-size:x-small;"><strong>When you&#8217;re in great  distress,<br />
call for God&#8217;s help from the very core of your heart.<br />
Be  sincere, Pray fervently.<br />
You will get His help.</strong></span></p>
 Tagged: how to know the mfc version, MFC version <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/155/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=155&subd=vctipsplusplus&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2009/07/14/how-to-know-the-mfc-version-you-are-using/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>RegDllView.. A nice utility</title>
		<link>http://vctipsplusplus.wordpress.com/2009/07/10/regdllview-a-nice-utility/</link>
		<comments>http://vctipsplusplus.wordpress.com/2009/07/10/regdllview-a-nice-utility/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 04:16:50 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[dll register tool]]></category>
		<category><![CDATA[manually register dll]]></category>
		<category><![CDATA[manually unregister dll]]></category>
		<category><![CDATA[Regdllview]]></category>
		<category><![CDATA[register dll]]></category>
		<category><![CDATA[unregister dll]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=148</guid>
		<description><![CDATA[Hi all,
Today i&#8217;m talking about a nice utility, that I found during my googling.
RegDllView
It is a very simple and is very useful for all Windows programmers. During the development/unit testing/debugging of various types of DLLs, it is very useful tool.
RegDllView is a small utility that displays the list of all registered dll/ocx/exe files (COM registration). [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=148&subd=vctipsplusplus&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hi all,</p>
<p>Today i&#8217;m talking about a nice utility, that I found during my googling.</p>
<p><a href="http://www.nirsoft.net/utils/registered_dll_view.html" target="_blank"><strong>RegDllView</strong></a></p>
<p>It is a very simple and is very useful for all Windows programmers. During the development/unit testing/debugging of various types of DLLs, it is very useful tool.</p>
<blockquote><p><em>RegDllView is a small utility that displays the list of all registered dll/ocx/exe files (COM registration). For each registered file, you can view the last date/time that it was registered, and the list of all registration entries (CLSID/ProgID).<br />
RegDllView also allows you to unregister dll/ocx files that you don&#8217;t need on your system anymore. If you have dll/ocx files that don&#8217;t exist on your system anymore, but their registration entries are still exist in your Registry, you can manually remove these entries by using &#8216;Delete All Entries For Selected Files&#8217; option.</em></p></blockquote>
<p><img class="alignnone size-full wp-image-149" title="regdllview" src="http://vctipsplusplus.files.wordpress.com/2009/07/regdllview.gif?w=500&#038;h=295" alt="regdllview" width="500" height="295" /></p>
<p>You can download the same from <a title="Download" href="http://www.nirsoft.net/utils/regdllview.zip">http://www.nirsoft.net/utils/regdllview.zip</a></p>
<p style="line-height:1.6em;margin:.7em 0;padding:0;">for <a style="text-decoration:none;color:#265e15;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><a title="Download" href="http://www.nirsoft.net/utils/regdllview.zip"></a></p>
<p><a title="Download" href="http://www.nirsoft.net/utils/regdllview.zip"></a></p>
<p><a title="Download" href="http://www.nirsoft.net/utils/regdllview.zip"></a></p>
<p><a title="Download" href="http://www.nirsoft.net/utils/regdllview.zip"></a></p>
<p><a title="Download" href="http://www.nirsoft.net/utils/regdllview.zip"></a></p>
 Tagged: dll register tool, manually register dll, manually unregister dll, Regdllview, register dll, unregister dll <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/148/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=148&subd=vctipsplusplus&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2009/07/10/regdllview-a-nice-utility/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/07/regdllview.gif" medium="image">
			<media:title type="html">regdllview</media:title>
		</media:content>
	</item>
		<item>
		<title>My Marriage Invitation</title>
		<link>http://vctipsplusplus.wordpress.com/2009/04/30/my-marriage-invitation/</link>
		<comments>http://vctipsplusplus.wordpress.com/2009/04/30/my-marriage-invitation/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 06:10:09 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[Visual C++]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=145</guid>
		<description><![CDATA[
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=145&subd=vctipsplusplus&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="size-full wp-image-144 aligncenter" title="Invitation Card" src="http://vctipsplusplus.files.wordpress.com/2009/04/invitation.jpg?w=510&#038;h=339" alt="Invitation Card" width="510" height="339" /></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/145/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=145&subd=vctipsplusplus&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2009/04/30/my-marriage-invitation/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/04/invitation.jpg" medium="image">
			<media:title type="html">Invitation Card</media:title>
		</media:content>
	</item>
		<item>
		<title>Different Image Conversion Techniques</title>
		<link>http://vctipsplusplus.wordpress.com/2009/04/08/different-image-conversion-techniques/</link>
		<comments>http://vctipsplusplus.wordpress.com/2009/04/08/different-image-conversion-techniques/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 04:57:54 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[BMP TO GIF]]></category>
		<category><![CDATA[BMP to JPEG/JPG]]></category>
		<category><![CDATA[BMP to PNG]]></category>
		<category><![CDATA[BMP TO TIFF]]></category>
		<category><![CDATA[Different Image Conversion Techniques]]></category>
		<category><![CDATA[GIF to BMP]]></category>
		<category><![CDATA[GIF to JPG]]></category>
		<category><![CDATA[GIF to PNG]]></category>
		<category><![CDATA[image conversion C++]]></category>
		<category><![CDATA[image conversion GDI+]]></category>
		<category><![CDATA[image conversion VC++]]></category>
		<category><![CDATA[JPG to BMP]]></category>
		<category><![CDATA[JPG to PNG]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/2009/04/08/different-image-conversion-techniques/</guid>
		<description><![CDATA[Well, so many image formats are available in the world. Like BMP (Bitmap),TIFF (Tagged Image File Format ), JPG/JPEG (Joint Photographic Experts Group),GIF (Graphic Interchange Format),PNG (Portable Network Graphics) etc.
I already mentioned that, my current multimedia project gave me a lot of chance to improve my coding practice as well as to learn a lot [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=141&subd=vctipsplusplus&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Well, so many image formats are available in the world. Like BMP (Bitmap),TIFF (Tagged Image File Format ), JPG/JPEG (Joint Photographic Experts Group),GIF (Graphic Interchange Format),PNG (Portable Network Graphics) etc.</p>
<p>I already mentioned that, my current multimedia project gave me a lot of chance to improve my coding practice as well as to learn a lot of new things, like GDI,GDI+,Cryptographic services etc.</p>
<p>One of the requirement for me was to “Convert images between different formats”. Nice requirement <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>And I’m  in bloody confident that, I can complete my work within a day. And I started my job. But…..:(</p>
<p>I searched MSDN and found IPicture, (Nice COM). By using that, I load the image,resized the image, cropped, etc.. Then the main requirement is in front of the curtain. “Image conversion.” and I use the IPicture::SaveAsFile(). Then only i noticed the method thoroughly. <em>“Saves the picture&#8217;s data into a stream in the <span style="color:#ff0000;"><strong>same format</strong></span> that it would save itself into a file. Bitmaps use the BMP file format, metafiles the WMF format, and icons the ICO format “</em></p>
<p>So again google the keyword..</p>
<p>Then one of my friend suggested this page.. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Converting a BMP Image to a PNG Image</strong> <a href="http://msdn.microsoft.com/en-us/library/ms533837(VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms533837(VS.85).aspx</a></p>
<p>A very simple and nice article. by using that, we can convert the images between different formats.</p>
<p><strong>code from MSDN</strong></p>
<pre>#include &lt;windows.h&gt;
#include &lt;gdiplus.h&gt;
#include &lt;stdio.h&gt;
using namespace Gdiplus;
int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
{
   UINT  num = 0;          // number of image encoders
   UINT  size = 0;         // size of the image encoder array in bytes

   ImageCodecInfo* pImageCodecInfo = NULL;

   GetImageEncodersSize(&amp;num, &amp;size);
   if(size == 0)
      return -1;  // Failure

   pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
   if(pImageCodecInfo == NULL)
      return -1;  // Failure

   GetImageEncoders(num, size, pImageCodecInfo);

   for(UINT j = 0; j &lt; num; ++j)
   {
      if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )
      {
         *pClsid = pImageCodecInfo[j].Clsid;
         free(pImageCodecInfo);
         return j;  // Success
      }
   }

   free(pImageCodecInfo);
   return -1;  // Failure
}</pre>
<p>INT main()</p>
<p>{</p>
<p>   // Initialize GDI+.</p>
<p>   GdiplusStartupInput gdiplusStartupInput;</p>
<p>   ULONG_PTR gdiplusToken;</p>
<p>   GdiplusStartup(&amp;gdiplusToken, &amp;gdiplusStartupInput, NULL);</p>
<p>   CLSID   encoderClsid;</p>
<p>   Status  stat;</p>
<p>   Image*   image = new Image(L&#8221;Bird.bmp&#8221;);</p>
<p>   // Get the CLSID of the PNG encoder.</p>
<p>   GetEncoderClsid(L&#8221;image/png&#8221;, &amp;encoderClsid);</p>
<p>   stat = image-&gt;Save(L&#8221;Bird.png&#8221;, &amp;encoderClsid, NULL);</p>
<p>   if(stat == Ok)</p>
<p>      printf(&#8220;Bird.png was saved successfully\n&#8221;);</p>
<p>   else</p>
<p>      printf(&#8220;Failure: stat = %d\n&#8221;, stat);</p>
<p>   delete image;</p>
<p>   GdiplusShutdown(gdiplusToken);</p>
<p>   return 0;</p>
<p>}</p>
<p> </p>
<p>For retrieving the Class Identifier for an Encoder we can use the following formats.</p>
<ul>
<li>image/bmp</li>
<li>image/jpeg</li>
<li>image/gif</li>
<li>image/tiff</li>
<li>image/png</li>
</ul>
<p>So again curtain…</p>
<p> </p>
<p><span style="font-family:Viner Hand ITC;">If you want to cross the sea, you have to step into the waves..</span></p>
<p><span style="font-family:Viner Hand ITC;">At first, the waves may distract you;</span></p>
<p><span style="font-family:Viner Hand ITC;">But gradually, you will subdue the fear within you.</span></p>
<p><span style="font-family:Viner Hand ITC;">For, no wave is mightier than the power of your mind.</span></p>
<p> </p>
<p>for <a title="http://vctipsplusplus.wordpress.com/" href="http://vctipsplusplus.wordpress.com/">http://vctipsplusplus.wordpress.com/</a></p>
<p>BijU</p>
 Tagged: BMP TO GIF, BMP to JPEG/JPG, BMP to PNG, BMP TO TIFF, Different Image Conversion Techniques, GIF to BMP, GIF to JPG, GIF to PNG, image conversion C++, image conversion GDI+, image conversion VC++, JPG to BMP, JPG to PNG <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/141/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=141&subd=vctipsplusplus&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2009/04/08/different-image-conversion-techniques/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>Changing the background color of window created with CreatewindowEx()</title>
		<link>http://vctipsplusplus.wordpress.com/2009/02/04/changing-the-background-color-of-window-created-with-createwindowex/</link>
		<comments>http://vctipsplusplus.wordpress.com/2009/02/04/changing-the-background-color-of-window-created-with-createwindowex/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 06:51:53 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE);]]></category>
		<category><![CDATA[Changing the background color of window created with createwindowEx()]]></category>
		<category><![CDATA[CreateWindowEx()]]></category>
		<category><![CDATA[hbrBackground]]></category>
		<category><![CDATA[winodow background color]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/?p=132</guid>
		<description><![CDATA[Recently, I wanted to create a window using Win32. That was the first time, i created a window with Win32  
I successfully created the Window using CreateWindowEx(..).  The visaul appearance is same as MFC Dialog. 
Alas !! I faced one simple but serious problem. My Window looks white.

I couldn&#8217;t change the background color..   [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=132&subd=vctipsplusplus&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Recently, I wanted to create a window using Win32. That was the first time, i created a window with Win32 <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I successfully created the Window using CreateWindowEx(..).  The visaul appearance is same as MFC Dialog. </p>
<p>Alas !! I faced one simple but serious problem. My Window looks <strong>white.</strong></p>
<p><strong><img class="alignnone size-full wp-image-134" title="white1" src="http://vctipsplusplus.files.wordpress.com/2009/02/white1.jpg?w=300&#038;h=150" alt="white1" width="300" height="150" /></strong></p>
<p>I couldn&#8217;t change the background color.. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  &#8230; I tried a lot with the params and styles of CreateWindow(). Ooops.. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>After that, I just go throgh Win32 documentation..hey one flag is there in the <strong>WNDCLASS </strong>structure.</p>
<p>xxxx.hbrBackground<span> </span>= (HBRUSH)GetSysColorBrush(COLOR_3DFACE);</p>
<p> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now.. just look at my window.. Its pretty good na !!!</p>
<p><img class="alignnone size-full wp-image-135" title="dlg" src="http://vctipsplusplus.files.wordpress.com/2009/02/dlg.jpg?w=300&#038;h=150" alt="dlg" width="300" height="150" /></p>
<p> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><span style="font-family:Tahoma;font-size:x-small;"><strong>Believe only what you see, what you test and judge to be true.</strong></span><span style="font-size:small;"><br />
</span></p>
<p><strong></strong></p>
<p><span style="font-weight:normal;">for http://vctipsplusplus.wordpress.com/<br />
</span></p>
<p><span style="font-weight:normal;">BijU</span></p>
 Tagged: .hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE);, Changing the background color of window created with createwindowEx(), CreateWindowEx(), hbrBackground, winodow background color <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/132/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/132/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/132/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=132&subd=vctipsplusplus&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2009/02/04/changing-the-background-color-of-window-created-with-createwindowex/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/02/white1.jpg" medium="image">
			<media:title type="html">white1</media:title>
		</media:content>

		<media:content url="http://vctipsplusplus.files.wordpress.com/2009/02/dlg.jpg" medium="image">
			<media:title type="html">dlg</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating Folders/Directories Made Simple</title>
		<link>http://vctipsplusplus.wordpress.com/2009/01/13/creating-foldersdirectories-made-simple/</link>
		<comments>http://vctipsplusplus.wordpress.com/2009/01/13/creating-foldersdirectories-made-simple/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 11:55:21 +0000</pubDate>
		<dc:creator>BijU</dc:creator>
				<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[CreateDirectory]]></category>
		<category><![CDATA[Creating intermediate folders]]></category>
		<category><![CDATA[Creating the folder structure]]></category>
		<category><![CDATA[SHCreateDirectory]]></category>
		<category><![CDATA[using CreateDirectory API]]></category>
		<category><![CDATA[using SHCreateDirectory API]]></category>

		<guid isPermaLink="false">http://vctipsplusplus.wordpress.com/2009/01/13/creating-foldersdirectories-made-simple/</guid>
		<description><![CDATA[
I got this thread from one of my senior, while discussing about our project. Till then, I didn’t noticed any differences between SHCreateDirectoryEx() and CreateDirectory(). But now.. Yes its is.. some .. lil difference is there.
just look at the function call
for eg:
if (CreateDirectory(&#8220;c:\\Test\\Test\\Test\\Test&#8221;,NULL))
        AfxMessageBox(&#8220;Created &#8220;);
if (ERROR_SUCCESS == SHCreateDirectoryEx(NULL,&#8221;c:\\Test\\Test\\Test\\Test&#8221;,NULL))
{
    AfxMessageBox(&#8220;Created&#8221;);
}
description from MSDN is like that for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=129&subd=vctipsplusplus&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://vctipsplusplus.files.wordpress.com/2009/01/image1.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" src="http://vctipsplusplus.files.wordpress.com/2009/01/image-thumb1.png?w=644&#038;h=370" border="0" alt="image" width="644" height="370" /></a></p>
<p>I got this thread from one of my senior, while discussing about our project. Till then, I didn’t noticed any differences between <strong>SHCreateDirectoryEx()</strong> and <strong>CreateDirectory(). </strong>But now.. Yes its is.. some .. lil difference is there.</p>
<p>just look at the function call</p>
<p>for eg:</p>
<p>if (CreateDirectory(&#8220;c:\\Test\\Test\\Test\\Test&#8221;,NULL))<br />
        AfxMessageBox(&#8220;Created &#8220;);</p>
<p>if (ERROR_SUCCESS == SHCreateDirectoryEx(NULL,&#8221;c:\\Test\\Test\\Test\\Test&#8221;,NULL))<br />
{<br />
    AfxMessageBox(&#8220;Created&#8221;);<br />
}</p>
<p>description from MSDN is like that for SHCreateDirectoryEX()</p>
<h3><code><strong></strong></code></h3>
<p><code><span style="font-family:Arial;">int SHCreateDirectoryEx(</span></code><code><span style="font-family:Arial;">HWND<em> hwnd</em>, </span><span style="font-family:Arial;">LPCTSTR<em> pszPath</em>, </span><span style="font-family:Arial;">SECURITY_ATTRIBUTES<em> *psa</em></span><code><span style="font-family:Arial;">);</span></code></code></p>
<p><span style="font-family:Arial;">BOOL CreateDirectory(LPCTSTR <em><a>lpPathName</a></em>,LPSECURITY_ATTRIBUTES <em><a>lpSecurityAttributes</a> </em>);</span></p>
<p>This function creates a file system folder whose fully qualified path is given by <em>pszPath</em>. <strong><span style="color:#ff0000;">If one or more of the intermediate folders do not exist, they will be created as well.</span></strong></p>
<p>for CreateDirectory() the description is like this “ This function creates a new directory”</p>
<p> </p>
<p>Hope now you noticed the difference from the description itself. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p> </p>
<p> </p>
<p><strong>True commitment begins when we decide to do it anyway.</strong></p>
<p>for http://vctipsplusplus.wordpress.com/</p>
<p>BijU</p>
<p> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a90bce7f-70fc-4d04-97bd-6fe732f77f84" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/using+CreateDirectory+API">using CreateDirectory API</a>,<a rel="tag" href="http://technorati.com/tags/using+SHCreateDirectory+API">using SHCreateDirectory API</a>,<a rel="tag" href="http://technorati.com/tags/CreateDirectory">CreateDirectory</a>,<a rel="tag" href="http://technorati.com/tags/SHCreateDirectory">SHCreateDirectory</a>,<a rel="tag" href="http://technorati.com/tags/Creating+intermediate+folders">Creating intermediate folders</a></div>
 Tagged: CreateDirectory, Creating intermediate folders, Creating the folder structure, SHCreateDirectory, using CreateDirectory API, using SHCreateDirectory API <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vctipsplusplus.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vctipsplusplus.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vctipsplusplus.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vctipsplusplus.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vctipsplusplus.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vctipsplusplus.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vctipsplusplus.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vctipsplusplus.wordpress.com/129/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vctipsplusplus.wordpress.com/129/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vctipsplusplus.wordpress.com/129/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vctipsplusplus.wordpress.com&blog=3506930&post=129&subd=vctipsplusplus&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vctipsplusplus.wordpress.com/2009/01/13/creating-foldersdirectories-made-simple/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/01/image-thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>