<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Style files location in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/style-files-location/m-p/604776#M16191</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there any function or property in ArcObjects (.NET) which resolves paths to style files location? I want to avoid hardcoding strings like "C:\Program Files\ArcGIS\Desktop10.1\Styles". I am using ArcGIS 10.1 SP1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS Help says there are user and system folders:&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt; &amp;lt;install drive&amp;gt;:\Program Files\ArcGIS\Desktop10.1\Styles&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt; On Windows XP, it is located at &amp;lt;install drive&amp;gt;:\Documents and Settings\&amp;lt;username&amp;gt;\Application Data\ESRI\Desktop10.1\ArcMap&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt; On Windows Vista and Windows 7, it is located at &amp;lt;install drive&amp;gt;:\Users\&amp;lt;username&amp;gt;\AppData\Roaming\ESRI\Desktop10.1\ArcMap&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Feb 2013 00:31:03 GMT</pubDate>
    <dc:creator>IlyaSolovyev</dc:creator>
    <dc:date>2013-02-19T00:31:03Z</dc:date>
    <item>
      <title>Style files location</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/style-files-location/m-p/604776#M16191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there any function or property in ArcObjects (.NET) which resolves paths to style files location? I want to avoid hardcoding strings like "C:\Program Files\ArcGIS\Desktop10.1\Styles". I am using ArcGIS 10.1 SP1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS Help says there are user and system folders:&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt; &amp;lt;install drive&amp;gt;:\Program Files\ArcGIS\Desktop10.1\Styles&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt; On Windows XP, it is located at &amp;lt;install drive&amp;gt;:\Documents and Settings\&amp;lt;username&amp;gt;\Application Data\ESRI\Desktop10.1\ArcMap&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt; On Windows Vista and Windows 7, it is located at &amp;lt;install drive&amp;gt;:\Users\&amp;lt;username&amp;gt;\AppData\Roaming\ESRI\Desktop10.1\ArcMap&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 00:31:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/style-files-location/m-p/604776#M16191</guid>
      <dc:creator>IlyaSolovyev</dc:creator>
      <dc:date>2013-02-19T00:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: Style files location</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/style-files-location/m-p/604777#M16192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can get the styles from the registry.&amp;nbsp; In 10.0 it is under HKEY_LOCAL_MACHINE\Software\ESRI\Desktop10.0\CoreRuntime\StyleDir.&amp;nbsp; I assume desktop 10.1 has something very similar.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The main annoyance of using that method is you would have to update the code every time you changed version...&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You might be better off getting a reference to the ArcMap.exe through .net reflections which gives you the path to the bin directory and work your way back to styles.&amp;nbsp; Of course if esri changes the location in a future version, that won't work either.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 12:40:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/style-files-location/m-p/604777#M16192</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2013-02-19T12:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Style files location</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/style-files-location/m-p/604778#M16193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You can get the styles from the registry. In 10.0 it is under HKEY_LOCAL_MACHINE\Software\ESRI\Desktop10.0\CoreRuntime\StyleDir. I assume desktop 10.1 has something very similar. &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I use this approach now. Also check user's directory.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The main annoyance of using that method is you would have to update the code every time you changed version... &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That is why i dont like my approach.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You might be better off getting a reference to the ArcMap.exe through .net reflections which gives you the path to the bin directory and work your way back to styles. Of course if esri changes the location in a future version, that won't work either.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My application is standalone, it doesn't run in ArcMap.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2013 00:13:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/style-files-location/m-p/604778#M16193</guid>
      <dc:creator>IlyaSolovyev</dc:creator>
      <dc:date>2013-02-21T00:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Style files location</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/style-files-location/m-p/604779#M16194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I found out, that we can use IStyleGalleryStorage to retrieve style files folders.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;IStyleGallery StyleGallery = new StyleGalleryClass(); IStyleGalleryStorage StyleGalleryStorage = StyleGallery as IStyleGalleryStorage;&amp;nbsp; // This is Program Files styles folder string default = StyleGalleryStorage.DefaultLocation;&amp;nbsp; // All loaded style files for (int i = 0; i &amp;lt; StyleGalleryStorage.FileCount; i++) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string fullFilePath = StyleGalleryStorage.get_File(i); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Now you can get directory &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string dir = System.IO.Path.GetDirectoryName(fullFilePath); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!string.IsNullOrEmpty(dir) &amp;amp;&amp;amp; System.IO.Directory.Exists(dir)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Do smth &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2013 05:46:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/style-files-location/m-p/604779#M16194</guid>
      <dc:creator>IlyaSolovyev</dc:creator>
      <dc:date>2013-02-22T05:46:46Z</dc:date>
    </item>
  </channel>
</rss>

