<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-2212558652617325901.post9106393933175285240..comments</id><updated>2009-02-17T17:47:19.742-05:00</updated><category term='C#'/><category term='Threading'/><category term='Visual Studio'/><category term='Attributes'/><category term='Architecture'/><category term='Tip'/><category term='Fluent interfaces'/><category term='OOP'/><category term='Parallel Extensions'/><category term='Settings'/><category term='Debug'/><category term='Design'/><category term='Parallel Computing'/><category term='Property'/><category term='Generics'/><category term='Password'/><category term='Training'/><category term='Reflector'/><category term='DevTeach'/><category term='Silverlight'/><category term='Extension methods'/><title type='text'>Comments on Eric De C#: How to find Windows path</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.decarufel.net/feeds/9106393933175285240/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2212558652617325901/9106393933175285240/comments/default'/><link rel='alternate' type='text/html' href='http://blog.decarufel.net/2009/02/how-to-find-windows-path.html'/><author><name>Eric De C#</name><uri>http://www.blogger.com/profile/01046447681968794782</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_F9mN1vFyteY/STk80ggsyRI/AAAAAAAAD5g/XiVQebXFt_0/S220/Eric_De_Carufel_120x160.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2212558652617325901.post-6161360875785739023</id><published>2009-02-17T16:07:00.000-05:00</published><updated>2009-02-17T16:07:00.000-05:00</updated><title type='text'>I think having a hardcoded string ("%SystemRoot%")...</title><content type='html'>I think having a hardcoded string ("%SystemRoot%") is better than relying on an undocumented method.&lt;BR/&gt;&lt;BR/&gt;Alternative, you could use the native documented WinSDK method  SHGetSpecialFolderPath.  For example:&lt;BR/&gt;&lt;BR/&gt; public static String GetWindowsDirectory()&lt;BR/&gt; {&lt;BR/&gt;  const uint CSIDL_WINDOWS = 0x24;&lt;BR/&gt;  StringBuilder sb = new StringBuilder();&lt;BR/&gt;  UnsafeNativeMethods.SHGetSpecialFolderPath(0, sb, CSIDL_WINDOWS, 0);&lt;BR/&gt;  return sb.ToString();&lt;BR/&gt; }&lt;BR/&gt;//...&lt;BR/&gt;internal static class UnsafeNativeMethods&lt;BR/&gt;{&lt;BR/&gt; [DllImport("shell32.dll", SetLastError=true)]&lt;BR/&gt; public static extern int SHGetSpecialFolderPath(int hwndOwner, StringBuilder lpszPath, uint nFolder, int fCreate);&lt;BR/&gt;}</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2212558652617325901/9106393933175285240/comments/default/6161360875785739023'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2212558652617325901/9106393933175285240/comments/default/6161360875785739023'/><link rel='alternate' type='text/html' href='http://blog.decarufel.net/2009/02/how-to-find-windows-path.html?showComment=1234904820000#c6161360875785739023' title=''/><author><name>Peter Ritchie</name><uri>http://peter.ritchie.myopenid.com/</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/openid16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.decarufel.net/2009/02/how-to-find-windows-path.html' ref='tag:blogger.com,1999:blog-2212558652617325901.post-9106393933175285240' source='http://www.blogger.com/feeds/2212558652617325901/posts/default/9106393933175285240' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1200597067'/></entry></feed>
