<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://codehq.net/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>The Emission Locus</title><link>http://codehq.net/cs/blogs/john/default.aspx</link><description>Haphazard Thoughts and Opinions</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.2)</generator><item><title>Update: Encoding source files and documents as UTF-8 in VS2005</title><link>http://codehq.net/cs/blogs/john/archive/2007/06/21/update-encoding-source-files-and-documents-as-utf-8-in-vs2005.aspx</link><pubDate>Thu, 21 Jun 2007 15:27:00 GMT</pubDate><guid isPermaLink="false">0d78e8a6-5d58-4271-ba38-c33afed2bfdd:12</guid><dc:creator>john</dc:creator><slash:comments>0</slash:comments><comments>http://codehq.net/cs/blogs/john/comments/12.aspx</comments><wfw:commentRss>http://codehq.net/cs/blogs/john/commentrss.aspx?PostID=12</wfw:commentRss><wfw:comment>http://codehq.net/cs/blogs/john/rsscomments.aspx?PostID=12</wfw:comment><description>&lt;p&gt;The old code was a bit tacky, using a timer to trigger the file encoding dialog. And of course it was buggy: it wouldn't work for multiple documents opening simultaneously.&lt;/p&gt;&lt;p&gt;So I've fixed it properly by using the WindowEvents_WindowActivated event. So when a window is activated, and it matches one of those non-BOM documents added by the DocumentEvents_DocumentOpened event, the encoding dialog is triggered for the document and then the next one in the list (if available) is activated.&lt;/p&gt;&lt;p&gt;Follow the instructions in the &lt;a href="http://codehq.net/cs/blogs/john/archive/2007/06/15/encoding-source-files-and-documents-as-utf-8-in-vs2005.aspx" title="previous post"&gt;previous post&lt;/a&gt; to unpack and install (source included).&lt;/p&gt;&lt;p&gt;As usual, comments are welcome.&amp;nbsp;&lt;/p&gt;&lt;img src="http://codehq.net/cs/aggbug.aspx?PostID=12" width="1" height="1"&gt;</description><enclosure url="http://codehq.net/cs/blogs/john/attachment/12.ashx" length="19453" type="application/x-zip-compressed" /><category domain="http://codehq.net/cs/blogs/john/archive/tags/UTF-8/default.aspx">UTF-8</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/BOM/default.aspx">BOM</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/UTF-16LE/default.aspx">UTF-16LE</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/VS2005/default.aspx">VS2005</category></item><item><title>Encoding source files and documents as UTF-8 in VS2005 </title><link>http://codehq.net/cs/blogs/john/archive/2007/06/15/encoding-source-files-and-documents-as-utf-8-in-vs2005.aspx</link><pubDate>Sat, 16 Jun 2007 05:09:00 GMT</pubDate><guid isPermaLink="false">0d78e8a6-5d58-4271-ba38-c33afed2bfdd:11</guid><dc:creator>john</dc:creator><slash:comments>1</slash:comments><comments>http://codehq.net/cs/blogs/john/comments/11.aspx</comments><wfw:commentRss>http://codehq.net/cs/blogs/john/commentrss.aspx?PostID=11</wfw:commentRss><wfw:comment>http://codehq.net/cs/blogs/john/rsscomments.aspx?PostID=11</wfw:comment><description>&lt;P&gt;I'm picky about the encoding of my source files, HTML documents, etc. Whereever possible I save as either UTF-8&amp;nbsp;or UTF-16LE, both with a BOM (byte order mark). This ensures that the document can always be read without any&amp;nbsp;encoding issues.&lt;/P&gt;
&lt;P&gt;Although it has much better Unicode support than VS2003, VS2005 isn't very helpful with automatically selecting a file encoding; it assumes that the windows-1252 code page is sufficent.&amp;nbsp;VS2005 does have an "Advanced Save Options" dialog on the File menu to set the encoding, but its not completely automated. Replaying a&amp;nbsp;temporary macro recorded when using it will only bring up the dialog, but not choose&amp;nbsp;the encoding.&lt;/P&gt;
&lt;P&gt;My solution is&amp;nbsp;a macro hooked up to the IDE's document open event. It brings up the "Advanced Save Options" dialog if the file does not have a BOM and also matches one of the supported file extensions (this list can be modified to suit your preferences). It works for new and existing documents; if the file is read-only the dialog is suppressed.&lt;/P&gt;
&lt;P&gt;The environment doesn't directly support&amp;nbsp;a&amp;nbsp;"HasBOM" property as part of the EnvDTE.Document object so&amp;nbsp;I've worked around that by reading the first few bytes of the underlying file to detect the encoded BOM.&lt;/P&gt;
&lt;P&gt;To install unpack FixFileEncoding.vsmacros from the attachment&amp;nbsp;into a directory somewhere. Then use the Macro Explorer to load the macro project; when prompted you must enable the event handling code or it won't work. If you don't feel comfortable loading someone else's macro file, I've also included the EnvironmentEvents.vb source file in the .zip file. You'll need to create a new macro project and then import this module.&lt;/P&gt;
&lt;P&gt;VS2005 does have a cool feature for XML-style documents: if the document starts with a &amp;lt;?xml?&amp;gt; tag its encoding value is modified to match whatever is selected in the "Advanced Save Options" dialog. Very nice.&lt;/P&gt;&lt;img src="http://codehq.net/cs/aggbug.aspx?PostID=11" width="1" height="1"&gt;</description><enclosure url="http://codehq.net/cs/blogs/john/attachment/11.ashx" length="18177" type="application/x-zip-compressed" /><category domain="http://codehq.net/cs/blogs/john/archive/tags/UTF-8/default.aspx">UTF-8</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/BOM/default.aspx">BOM</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/UTF-16LE/default.aspx">UTF-16LE</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/VS2005/default.aspx">VS2005</category></item><item><title>"Australian international airports now have even more CYA security"</title><link>http://codehq.net/cs/blogs/john/archive/2007/03/15/australian-international-airports-now-have-even-more-cya-security.aspx</link><pubDate>Fri, 16 Mar 2007 06:24:00 GMT</pubDate><guid isPermaLink="false">0d78e8a6-5d58-4271-ba38-c33afed2bfdd:10</guid><dc:creator>john</dc:creator><slash:comments>0</slash:comments><comments>http://codehq.net/cs/blogs/john/comments/10.aspx</comments><wfw:commentRss>http://codehq.net/cs/blogs/john/commentrss.aspx?PostID=10</wfw:commentRss><wfw:comment>http://codehq.net/cs/blogs/john/rsscomments.aspx?PostID=10</wfw:comment><description>&lt;P&gt;The title of this post sounds like a sales pitch, but its just the morons in Australia's aviation security bureaucracy coming up with this rubbish for liquids, same as what has been done in&amp;nbsp;the UK and the US:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="http://www.dotars.gov.au/transport/security/aviation/lag/index.aspx"&gt;http://www.dotars.gov.au/transport/security/aviation/lag/index.aspx&lt;/A&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is more "cover your ass" security that is just going to irritate innocent people and impact sales at duty free stores. The idiots that came up with this idea obviously assume that the vague group known as "the terrorists" or "them" don't read newspapers or watch TV. If this type of plot was foiled before, I'm sure at least one of them is aware of that and would try something else.&lt;/P&gt;
&lt;P&gt;The whole thing is just an excuse for scared department heads to spend taxpayers' money to provide "enhanced safety" that has no benefit.&lt;/P&gt;
&lt;P&gt;Bruce Schneier mentions more on this&amp;nbsp;CYA nonsense in his &lt;A class="" title="latest Cryptogram newsletter" href="http://www.schneier.com/crypto-gram-0703.html"&gt;latest Cryptogram newsletter&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://codehq.net/cs/aggbug.aspx?PostID=10" width="1" height="1"&gt;</description><category domain="http://codehq.net/cs/blogs/john/archive/tags/Security/default.aspx">Security</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/CYA/default.aspx">CYA</category></item><item><title>Rebuilding the blog</title><link>http://codehq.net/cs/blogs/john/archive/2007/02/13/rebuilding-the-blog.aspx</link><pubDate>Wed, 14 Feb 2007 06:47:00 GMT</pubDate><guid isPermaLink="false">0d78e8a6-5d58-4271-ba38-c33afed2bfdd:9</guid><dc:creator>john</dc:creator><slash:comments>0</slash:comments><comments>http://codehq.net/cs/blogs/john/comments/9.aspx</comments><wfw:commentRss>http://codehq.net/cs/blogs/john/commentrss.aspx?PostID=9</wfw:commentRss><wfw:comment>http://codehq.net/cs/blogs/john/rsscomments.aspx?PostID=9</wfw:comment><description>I'm slowly rebuilding the blog articles and associated downloads, after moving to a &lt;A class="" title="new ISP" href="http://www.godaddy.com/" target=_blank&gt;new ISP&lt;/A&gt; from my self-hosted setup. Much easier to manage given the issues I've had with &lt;A class="" title="Bigpond's" href="http://www.bigpond.com/" target=_blank&gt;Bigpond's&lt;/A&gt; new login system.&lt;img src="http://codehq.net/cs/aggbug.aspx?PostID=9" width="1" height="1"&gt;</description><category domain="http://codehq.net/cs/blogs/john/archive/tags/Blog/default.aspx">Blog</category></item><item><title>I uninstalled IE7 within 30 minutes of installing it</title><link>http://codehq.net/cs/blogs/john/archive/2006/12/20/i-uninstalled-ie7-within-30-minutes-of-installing-it.aspx</link><pubDate>Thu, 21 Dec 2006 04:34:00 GMT</pubDate><guid isPermaLink="false">0d78e8a6-5d58-4271-ba38-c33afed2bfdd:2</guid><dc:creator>john</dc:creator><slash:comments>0</slash:comments><comments>http://codehq.net/cs/blogs/john/comments/2.aspx</comments><wfw:commentRss>http://codehq.net/cs/blogs/john/commentrss.aspx?PostID=2</wfw:commentRss><wfw:comment>http://codehq.net/cs/blogs/john/rsscomments.aspx?PostID=2</wfw:comment><description>&lt;P&gt;Now I may not be a typical IE user, since I'm a developer, but I am more of a keyboard person than a mouse person.&lt;/P&gt;
&lt;P&gt;Frankly, whoever it was on the IE7 design team that decided to make the address and command bars immovable should be given a good beating. And the same goes for the search box feature, which you can't hide or reposition.&lt;/P&gt;
&lt;P&gt;In my IE6 configuration I have the menu on the top row, the next row has the tool icons (including Print Preview) and the Links bar, and the last row has the address bar and Google plug-in (for auto-complete, etc.). Using this configuration, if I get to the last link on a page one Tab keypress and I get to the address bar, another to the Google search, and then back to the page. IE7 adds another 4 or so Tab keypresses.&lt;/P&gt;
&lt;P&gt;I agree with making the toolbars properly accessible with the keyboard, but this should be configurable (for backwards compatibility) via the Advanced Options dialog, or at least a documented registry setting for power users. The drop-down buttons are a nice idea, but I should also be able to show them all on the bar itself. The toolbar customization process is still minimalist and different to other products such as Visual Studio 2005, Visio 2003, etc.&lt;/P&gt;
&lt;P&gt;Overall, 1 out of 5. Only recommended if you never customize IE and take what you're given.&lt;/P&gt;&lt;img src="http://codehq.net/cs/aggbug.aspx?PostID=2" width="1" height="1"&gt;</description><category domain="http://codehq.net/cs/blogs/john/archive/tags/IE7/default.aspx">IE7</category></item><item><title>Tommy Emmanual is a guitar legend</title><link>http://codehq.net/cs/blogs/john/archive/2006/10/24/tommy-emmanual-is-a-guitar-legend.aspx</link><pubDate>Tue, 24 Oct 2006 10:51:00 GMT</pubDate><guid isPermaLink="false">0d78e8a6-5d58-4271-ba38-c33afed2bfdd:3</guid><dc:creator>john</dc:creator><slash:comments>0</slash:comments><comments>http://codehq.net/cs/blogs/john/comments/3.aspx</comments><wfw:commentRss>http://codehq.net/cs/blogs/john/commentrss.aspx?PostID=3</wfw:commentRss><wfw:comment>http://codehq.net/cs/blogs/john/rsscomments.aspx?PostID=3</wfw:comment><description>&lt;P&gt;I have left Australia for a while and am currently in Singapore.&lt;/P&gt;
&lt;P&gt;Last night's concert by &lt;A href="http://www.tommyemmanuel.com/"&gt;Tommy Emmanuel&lt;/A&gt;&amp;nbsp;at the Victoria Theatre was brilliant, and everyone thoroughly enjoyed themselves for almost 3 hours. I've been an Australian&amp;nbsp;fan since the '80s and its easy to see that&amp;nbsp;Tommy's talent&amp;nbsp;and techniques have continued to mature. If you like acoustic guitar make an effort to see him live; some of the things he can do&amp;nbsp;with&amp;nbsp;his guitars are&amp;nbsp;amazing. Highly recommended.&lt;/P&gt;&lt;img src="http://codehq.net/cs/aggbug.aspx?PostID=3" width="1" height="1"&gt;</description><category domain="http://codehq.net/cs/blogs/john/archive/tags/Music/default.aspx">Music</category></item><item><title>Using MSXML4 in an application installed by a non-administrator account</title><link>http://codehq.net/cs/blogs/john/archive/2006/08/24/using-msxml4-in-an-application-installed-by-a-non-administrator-account.aspx</link><pubDate>Thu, 24 Aug 2006 10:55:00 GMT</pubDate><guid isPermaLink="false">0d78e8a6-5d58-4271-ba38-c33afed2bfdd:1</guid><dc:creator>admin_user</dc:creator><slash:comments>0</slash:comments><comments>http://codehq.net/cs/blogs/john/comments/1.aspx</comments><wfw:commentRss>http://codehq.net/cs/blogs/john/commentrss.aspx?PostID=1</wfw:commentRss><wfw:comment>http://codehq.net/cs/blogs/john/rsscomments.aspx?PostID=1</wfw:comment><description>&lt;P&gt;An application I've been working on requires MSXML4 for validating instance documents against an embedded schema, but one of the installation requirements is that it must be able to be installed by a non-administrator. The offical Microsoft installer requires administrator privileges so this option is out. This caused a few headaches.&lt;/P&gt;
&lt;P&gt;Then I remembered that application manifests can specify a list of COM objects exposed by a local DLL. This led to a solution that works, but is &lt;STRONG&gt;not&lt;/STRONG&gt; Microsoft-approved.&lt;/P&gt;
&lt;P&gt;The trick is to install MSXML4 in side-by-side mode on the development box (use the custom install option), then navigate to the &lt;CODE&gt;\Windows\WinSxS&lt;/CODE&gt; folder. In the &lt;CODE&gt;Manifests&lt;/CODE&gt; subfolder you'll find .manifest files for the side-by-side installations of MSXML4.dll (the manifest filename includes MSXML2, which is the library's COM namespace) and MSXML4R.dll (the manifest filename includes MSXML2R). The MSXML4R version number must match the value&amp;nbsp;in the MSXML4 &lt;CODE&gt;&lt;/CODE&gt;element.&lt;/P&gt;
&lt;P&gt;Copy the entire &lt;CODE&gt;&lt;/CODE&gt;element from both the MSXML4 and MSXML4R manifests into your application manifest's &lt;CODE&gt;&lt;/CODE&gt;element (but don't copy MSXML4's &lt;CODE&gt;&lt;/CODE&gt;element). Now MSXML4 is part of your assembly.&lt;/P&gt;
&lt;P&gt;Also copy the matching DLLs from the &lt;CODE&gt;\Windows\WinSxS&lt;/CODE&gt; tree to your application folder and voila! MSXML4 can be installed and used by a non-administrator.&lt;/P&gt;
&lt;P&gt;Your application's folder should also have a &lt;CODE&gt;&lt;EM&gt;appname&lt;/EM&gt;.exe.local&lt;/CODE&gt; file so the COM redirector will force the local MSXML4 DLLs to always be used.&lt;/P&gt;
&lt;P&gt;Important things to remember are that this scenario is not supported by Microsoft and that any updates to the MSXML4 files must be serviced by your application.&lt;/P&gt;
&lt;P&gt;So an example manifest for Foo.exe using MSXML 4.0 SP2 (MSXML4.dll version 4.20.9818.0 and MSXML4R.dll version 4.1.0.0) should look something like this:&lt;/P&gt;&lt;PRE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&amp;gt;
&amp;lt;assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"&amp;gt;
 &amp;lt;assemblyIdentity type="win32" name="Foo.exe" version="1.0.0.0" processorArchitecture="X86"/&amp;gt;
  &amp;lt;file name="msxml4.dll" hash="80e5fb356b5f5cfe6f765a9ffe1eb749642a2e0f" hashalg="SHA1"&amp;gt;
   &amp;lt;typelib tlbid="{f5078f18-c551-11d3-89b9-0000f81fe221}" version="4.0" helpdir=""/&amp;gt;
   &amp;lt;comClass description="W3C-DOM XML Document (Apartment)"
             clsid="{88d969c0-f192-11d4-a65f-0040963251e5}"
             threadingModel="Apartment"
             progid="MSXML2.DOMDocument.4.0"
             tlbid="{f5078f18-c551-11d3-89b9-0000f81fe221}"/&amp;gt;
   &amp;lt;comClass description="W3C-DOM XML Document (Free threaded)"
             clsid="{88d969c1-f192-11d4-a65f-0040963251e5}"
             threadingModel="Free"
             progid="MSXML2.FreeThreadedDOMDocument.4.0"
             tlbid="{f5078f18-c551-11d3-89b9-0000f81fe221}"/&amp;gt;
   &amp;lt;comClass description="Object for caching schemas"
             clsid="{88d969c2-f192-11d4-a65f-0040963251e5}"
             threadingModel="Free"
             progid="MSXML2.XMLSchemaCache.4.0"
             tlbid="{f5078f18-c551-11d3-89b9-0000f81fe221}"/&amp;gt;
   &amp;lt;comClass description="Object for caching compiled XSL stylesheets"
             clsid="{88d969c3-f192-11d4-a65f-0040963251e5}"
             threadingModel="Free"
             progid="MSXML2.XSLTemplate.4.0"
             tlbid="{f5078f18-c551-11d3-89b9-0000f81fe221}"/&amp;gt;
   &amp;lt;comClass description="XML Data Source Object"
             clsid="{88d969c4-f192-11d4-a65f-0040963251e5}"
             threadingModel="Apartment"
             progid="MSXML2.DSOControl.4.0"
             tlbid="{f5078f18-c551-11d3-89b9-0000f81fe221}"/&amp;gt;
   &amp;lt;comClass description="XML HTTP Request class."
             clsid="{88d969c5-f192-11d4-a65f-0040963251e5}"
             threadingModel="Apartment"
             progid="MSXML2.XMLHTTP.4.0"
             tlbid="{f5078f18-c551-11d3-89b9-0000f81fe221}"/&amp;gt;
   &amp;lt;comClass description="Server XML HTTP Request class."
             clsid="{88d969c6-f192-11d4-a65f-0040963251e5}"
             threadingModel="Apartment"
             progid="MSXML2.ServerXMLHTTP.4.0"
             tlbid="{f5078f18-c551-11d3-89b9-0000f81fe221}"/&amp;gt;
   &amp;lt;comClass description="SAX XML Reader 4.0 coclass"
             clsid="{7c6e29bc-8b8b-4c3d-859e-af6cd158be0f}"
             threadingModel="Both"
             progid="MSXML2.SAXXMLReader.4.0"
             tlbid="{f5078f18-c551-11d3-89b9-0000f81fe221}"/&amp;gt;
   &amp;lt;comClass description="Microsoft XML Writer 4.0 coclass"
             clsid="{88d969c8-f192-11d4-a65f-0040963251e5}"
             threadingModel="Both"
             progid="MSXML2.MXXMLWriter.4.0"
             tlbid="{f5078f18-c551-11d3-89b9-0000f81fe221}"/&amp;gt;
   &amp;lt;comClass description="Microsoft HTML Writer 4.0 coclass"
             clsid="{88d969c9-f192-11d4-a65f-0040963251e5}"
             threadingModel="Both"
             progid="MSXML2.MXHTMLWriter.4.0"
             tlbid="{f5078f18-c551-11d3-89b9-0000f81fe221}"/&amp;gt;
   &amp;lt;comClass description="SAX Attributes 4.0 coclass"
             clsid="{88d969ca-f192-11d4-a65f-0040963251e5}"
             threadingModel="Both"
             progid="MSXML2.SAXAttributes.4.0"
             tlbid="{f5078f18-c551-11d3-89b9-0000f81fe221}"/&amp;gt;
   &amp;lt;comClass description="MX Namespace Manager 4.0 coclass"
             clsid="{88d969d6-f192-11d4-a65f-0040963251e5}"
             threadingModel="Both"
             progid="MSXML2.MXNamespaceManager.4.0"
             tlbid="{f5078f18-c551-11d3-89b9-0000f81fe221}"/&amp;gt;
  &amp;lt;/file&amp;gt;
  &amp;lt;file name="msxml4r.dll" hash="e09c7d1cb933719ab19ddae866e6cc0846eccdc4" hashalg="SHA1"/&amp;gt;
&amp;lt;/assembly&amp;gt;&lt;/PRE&gt;&lt;img src="http://codehq.net/cs/aggbug.aspx?PostID=1" width="1" height="1"&gt;</description><category domain="http://codehq.net/cs/blogs/john/archive/tags/Code/default.aspx">Code</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/MSXML/default.aspx">MSXML</category></item><item><title>Issue with application manifests on XP</title><link>http://codehq.net/cs/blogs/john/archive/2006/07/12/issue-with-application-manifests-on-xp.aspx</link><pubDate>Wed, 12 Jul 2006 16:47:00 GMT</pubDate><guid isPermaLink="false">0d78e8a6-5d58-4271-ba38-c33afed2bfdd:5</guid><dc:creator>john</dc:creator><slash:comments>0</slash:comments><comments>http://codehq.net/cs/blogs/john/comments/5.aspx</comments><wfw:commentRss>http://codehq.net/cs/blogs/john/commentrss.aspx?PostID=5</wfw:commentRss><wfw:comment>http://codehq.net/cs/blogs/john/rsscomments.aspx?PostID=5</wfw:comment><description>&lt;P&gt;Someone forgot to test for this:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create an application manifest document (e.g. &lt;CODE&gt;foo.exe.manifest&lt;/CODE&gt;) and include it as part of your &lt;CODE&gt;foo&lt;/CODE&gt; application. &lt;/LI&gt;
&lt;LI&gt;Mark the &lt;CODE&gt;&amp;lt;xml&amp;gt;&lt;/CODE&gt; tag with the &lt;CODE&gt;encoding="UTF-8"&lt;/CODE&gt; atribute.&lt;/LI&gt;
&lt;LI&gt;Compile and test your sample app; works as expected. &lt;/LI&gt;
&lt;LI&gt;Now use VS's Advanced Save Options dialog (or Notepad's Encoding option on the Save As dialog) to save it as UTF-8 &lt;EM&gt;with a BOM marker.&lt;/EM&gt; This is a perfectly legal option.&lt;/LI&gt;
&lt;LI&gt;Recompile. The test run now fails!&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;So the process loader's internal XML parser doesn't handle the BOM marker. I'll have to log a bug for this.&lt;/P&gt;&lt;img src="http://codehq.net/cs/aggbug.aspx?PostID=5" width="1" height="1"&gt;</description><category domain="http://codehq.net/cs/blogs/john/archive/tags/Code/default.aspx">Code</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/Manifests/default.aspx">Manifests</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/Windows+XP/default.aspx">Windows XP</category></item><item><title>Custom Remote Desktop window sizes</title><link>http://codehq.net/cs/blogs/john/archive/2006/07/11/custom-remote-desktop-window-sizes.aspx</link><pubDate>Tue, 11 Jul 2006 08:54:00 GMT</pubDate><guid isPermaLink="false">0d78e8a6-5d58-4271-ba38-c33afed2bfdd:6</guid><dc:creator>john</dc:creator><slash:comments>0</slash:comments><comments>http://codehq.net/cs/blogs/john/comments/6.aspx</comments><wfw:commentRss>http://codehq.net/cs/blogs/john/commentrss.aspx?PostID=6</wfw:commentRss><wfw:comment>http://codehq.net/cs/blogs/john/rsscomments.aspx?PostID=6</wfw:comment><description>&lt;P&gt;Here's a good tip from&amp;nbsp;&lt;A href="http://www.kudzuworld.com/blogs/Tech/2006_07_10_A.aspx"&gt;Kudzu's blog&lt;/A&gt;:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;I use remote desktop a lot. But 800x600 is too small, and if I use 1024x768 then it goes full screen and its not convenient to move between host and guest easily. To compound this, I run multiple remote desktops as well as virtual PC's. What I really want to do is run remote desktop in about 1000x720 so I get a large screen but still have quick access to the task bar and system tray of my host. Remote desktop has no options for these custom resolutions, but you can edit the RDP file.&lt;/P&gt;
&lt;P&gt;Create a remote desktop connection and save the profile. It makes a file with an .rdp extension. This file is just a text file, so now open it in Notepad. The first few lines should look something like this: &lt;/P&gt;&lt;PRE&gt;    screen mode id:i:1
    desktopwidth:i:1015
    desktopheight:i:715
    session bpp:i:16
    winposstr:s:0,3,0,0,1015,725&lt;/PRE&gt;
&lt;P&gt;I have done some testing and I found 1015x715 to be just about right for a 1024x768 host. The &lt;CODE&gt;winposstr&lt;/CODE&gt; line specifies the initial size of the window on the host. Setting the second parameter to 3 makes it auto fit, and thus the other numbers are not needed.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;img src="http://codehq.net/cs/aggbug.aspx?PostID=6" width="1" height="1"&gt;</description><category domain="http://codehq.net/cs/blogs/john/archive/tags/Code/default.aspx">Code</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/Remote+Desktop/default.aspx">Remote Desktop</category></item><item><title>A gotcha with the SetLocalTime API</title><link>http://codehq.net/cs/blogs/john/archive/2006/07/03/a-gotcha-with-the-setlocaltime-api.aspx</link><pubDate>Mon, 03 Jul 2006 11:59:00 GMT</pubDate><guid isPermaLink="false">0d78e8a6-5d58-4271-ba38-c33afed2bfdd:7</guid><dc:creator>john</dc:creator><slash:comments>0</slash:comments><comments>http://codehq.net/cs/blogs/john/comments/7.aspx</comments><wfw:commentRss>http://codehq.net/cs/blogs/john/commentrss.aspx?PostID=7</wfw:commentRss><wfw:comment>http://codehq.net/cs/blogs/john/rsscomments.aspx?PostID=7</wfw:comment><description>&lt;P&gt;Its been a long time between posts; I've been consumed by the tail end of a major project, including a number of longer-than-expected overseas trips. Anyway, to the issue at hand:&lt;/P&gt;
&lt;P&gt;If your code calls SetLocalTime take special note of the &lt;A href="http://msdn.microsoft.com/library/en-us/sysinfo/base/setlocaltime.asp" target=_blank&gt;documentation&lt;/A&gt; in recent versions of the PSDK (and also mentioned in MSKB article &lt;A href="http://support.microsoft.com/?kbid=234735" target=_blank&gt;234735&lt;/A&gt;):&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;"The system uses UTC internally. Therefore, when you call SetLocalTime, the system uses the current time zone information to perform the conversion, including the daylight saving time setting. Note that the system uses the daylight saving time setting of the current time, not the new time you are setting. Therefore, to ensure the correct result, call SetLocalTime a second time, now that the first call has updated the daylight saving time setting."&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This tripped one of my test cases for an embedded application that may adjust the system time.&lt;/P&gt;&lt;img src="http://codehq.net/cs/aggbug.aspx?PostID=7" width="1" height="1"&gt;</description><category domain="http://codehq.net/cs/blogs/john/archive/tags/Code/default.aspx">Code</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/Bug/default.aspx">Bug</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/SetLocalTime/default.aspx">SetLocalTime</category></item><item><title>Workaround for bug in FormatMessage API</title><link>http://codehq.net/cs/blogs/john/archive/2005/11/28/workaround-for-bug-in-formatmessage-api.aspx</link><pubDate>Mon, 28 Nov 2005 13:59:00 GMT</pubDate><guid isPermaLink="false">0d78e8a6-5d58-4271-ba38-c33afed2bfdd:8</guid><dc:creator>john</dc:creator><slash:comments>0</slash:comments><comments>http://codehq.net/cs/blogs/john/comments/8.aspx</comments><wfw:commentRss>http://codehq.net/cs/blogs/john/commentrss.aspx?PostID=8</wfw:commentRss><wfw:comment>http://codehq.net/cs/blogs/john/rsscomments.aspx?PostID=8</wfw:comment><description>&lt;P&gt;The FormatMessage API appears to have a bug that causes its behaviour to not match its documentation.&lt;/P&gt;
&lt;P&gt;This occurs when the specified module does not have a MESSAGETABLE resource and both the FORMAT_MESSAGE_FROM_HMODULE and FORMAT_MESSAGE_FROM_SYSTEM flags are specified. Instead of continuing the search in the system modules the API fails and GetLastError() returns ERROR_RESOURCE_TYPE_NOT_FOUND (1813).&lt;/P&gt;
&lt;P&gt;Here's the workaround:&lt;/P&gt;&lt;PRE&gt;HRESULT hr= E_ACCESSDENIED; //or whatever
_bstr_t rv; //for the error text

&lt;FONT color=#008000&gt;//
//NOTE: FormatMessage will fail if the FORMAT_MESSAGE_FROM_HMODULE
//      flag is specified and the module does not have a MESSAGETABLE
//      resource, even if FORMAT_MESSAGE_FROM_SYSTEM is specified!
//
&lt;/FONT&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;const &lt;/FONT&gt;&lt;FONT color=#000000&gt;DWORD moduleFlags= (  FORMAT_MESSAGE_ALLOCATE_BUFFER  |
                            FORMAT_MESSAGE_FROM_HMODULE     |
                            FORMAT_MESSAGE_MAX_WIDTH_MASK);

&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;const &lt;/FONT&gt;&lt;FONT color=#000000&gt;DWORD systemFlags= (  FORMAT_MESSAGE_ALLOCATE_BUFFER  |
                            FORMAT_MESSAGE_FROM_SYSTEM      |
                            FORMAT_MESSAGE_MAX_WIDTH_MASK);

CHeapPtr&amp;lt;WCHAR, CLocalAllocator&amp;gt; msg;
&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;if &lt;/FONT&gt;&lt;FONT color=#000000&gt;(!::FormatMessage(moduleFlags, GetModuleHandle(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;NULL&lt;/FONT&gt;&lt;FONT color=#000000&gt;),
        (DWORD)errorCode, &lt;/FONT&gt;&lt;FONT color=#ff0000&gt;0&lt;/FONT&gt;&lt;FONT color=#000000&gt;, (LPWSTR)&amp;amp;msg, &lt;/FONT&gt;&lt;FONT color=#ff0000&gt;0&lt;/FONT&gt;&lt;FONT color=#000000&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;NULL&lt;/FONT&gt;&lt;FONT color=#000000&gt;))
{
    ::FormatMessage(systemFlags, &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;NULL&lt;/FONT&gt;&lt;FONT color=#000000&gt;, (DWORD)errorCode, &lt;/FONT&gt;&lt;FONT color=#ff0000&gt;0&lt;/FONT&gt;&lt;FONT color=#000000&gt;,
            (LPWSTR)&amp;amp;msg, &lt;/FONT&gt;&lt;FONT color=#ff0000&gt;0&lt;/FONT&gt;&lt;FONT color=#000000&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;NULL&lt;/FONT&gt;&lt;FONT color=#000000&gt;);
}

rv= msg;
&lt;/FONT&gt;
&lt;/PRE&gt;
&lt;P&gt;Note: the code uses the ATL CHeapPtr and CLocalAllocator classes.&lt;/P&gt;&lt;img src="http://codehq.net/cs/aggbug.aspx?PostID=8" width="1" height="1"&gt;</description><category domain="http://codehq.net/cs/blogs/john/archive/tags/Code/default.aspx">Code</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/FormatMessage/default.aspx">FormatMessage</category><category domain="http://codehq.net/cs/blogs/john/archive/tags/Workaround/default.aspx">Workaround</category></item></channel></rss>