<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: registry code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 17 May 2008 08:33:24 GMT</pubDate>
    <description>DZone Snippets: registry code</description>
    <item>
      <title>Excel VBA : read registry key values on a remote computer using WMI</title>
      <link>http://snippets.dzone.com/posts/show/4675</link>
      <description>// VBA code to paste in an module&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Function ORACLEHOMES(strComputer As String)&lt;br /&gt;    Const HKEY_LOCAL_MACHINE = &amp;H80000002&lt;br /&gt;    ORACLEHOMES = ""&lt;br /&gt;    Dim strKeyPath&lt;br /&gt;    Dim arrSubKeys&lt;br /&gt;    Dim oReg&lt;br /&gt;    Dim strValueName&lt;br /&gt;    Dim strValue&lt;br /&gt;    'strComputer = "."&lt;br /&gt;    Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\default:StdRegProv")&lt;br /&gt;    strKeyPath = "SOFTWARE\ORACLE"&lt;br /&gt;    oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys&lt;br /&gt;    For Each subkey In arrSubKeys&lt;br /&gt;        If Left(subkey, 4) = "KEY_" Then&lt;br /&gt;            strValueName = "ORACLE_HOME"&lt;br /&gt;            oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath &amp; "\" &amp; subkey, strValueName, strValue&lt;br /&gt;            If ORACLEHOMES = "" Then&lt;br /&gt;                ORACLEHOMES = strValue&lt;br /&gt;            Else&lt;br /&gt;                ORACLEHOMES = ORACLEHOMES &amp; ";" &amp; strValue&lt;br /&gt;            End If&lt;br /&gt;        End If&lt;br /&gt;    Next&lt;br /&gt;End Function&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 19 Oct 2007 12:03:49 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4675</guid>
      <author>bouffon69 (Sylvain Le Courtois)</author>
    </item>
    <item>
      <title>Open/Creates a Base Key in the Registry</title>
      <link>http://snippets.dzone.com/posts/show/4524</link>
      <description>// open a Base Key in the registry&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;       public static RegistryKey GetKey(string baseKey)&lt;br /&gt;        {&lt;br /&gt;            RegistryKey key;&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                key = Registry.LocalMachine.OpenSubKey(baseKey, true);&lt;br /&gt;&lt;br /&gt;                if (key == null)&lt;br /&gt;                {&lt;br /&gt;                    key = Registry.LocalMachine.CreateSubKey(baseKey);&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    MessageBox.Show("Base key resolved");&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            catch (Exception e)&lt;br /&gt;            {&lt;br /&gt;                return null;&lt;br /&gt;            }&lt;br /&gt;            return key;&lt;br /&gt;        }&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 11 Sep 2007 11:58:28 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4524</guid>
      <author>dubby (Dave)</author>
    </item>
    <item>
      <title>Solution for a common problem: "Cannot write to the registry"</title>
      <link>http://snippets.dzone.com/posts/show/4055</link>
      <description>Original (not working):&lt;br /&gt;&lt;code&gt;&lt;br /&gt; RegistryKey reg = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop");&lt;br /&gt; reg.SetValue("WallpaperStyle", "1");    //2 for stretch&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Modified (working):&lt;br /&gt;&lt;code&gt;&lt;br /&gt; RegistryKey reg = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", true);&lt;br /&gt; reg.SetValue("WallpaperStyle", "1");    //2 for stretch&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 23 May 2007 12:20:00 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4055</guid>
      <author>mstampar (Miroslav Stampar)</author>
    </item>
    <item>
      <title>Wallpaper.reg</title>
      <link>http://snippets.dzone.com/posts/show/3115</link>
      <description>&lt;code&gt;&lt;br /&gt;[HKEY_CURRENT_USER\Control Panel\Desktop]&lt;br /&gt;"Wallpaper"="C:\\wallpaper.bmp"&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 09 Dec 2006 03:41:12 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3115</guid>
      <author>mcandre (Andrew Pennebaker)</author>
    </item>
    <item>
      <title>Basic Registry Access Example</title>
      <link>http://snippets.dzone.com/posts/show/1794</link>
      <description>// Basic Registry Access Example&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;RegistryKey key = Registry.LocalMachine.OpenSubKey("SOFTWARE\Company\Priduct\Version");&lt;br /&gt;if (key!=null)&lt;br /&gt;{&lt;br /&gt;string ini = key.GetValue("localinifile","").ToString();&lt;br /&gt;key.Close();&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 28 Mar 2006 20:31:11 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1794</guid>
      <author>codeguy (Sean Harvell)</author>
    </item>
    <item>
      <title>Change default action of non-URLs in Internet Explorer location bar</title>
      <link>http://snippets.dzone.com/posts/show/1566</link>
      <description>Turn this into a .reg file for people to use:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;REGEDIT4&lt;br /&gt;&lt;br /&gt;[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchURL]&lt;br /&gt;""="http://www.yoursite.com/search?&amp;q=%s"&lt;br /&gt;"provider"="x"&lt;/code&gt;</description>
      <pubDate>Fri, 24 Feb 2006 07:27:42 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1566</guid>
      <author>peter (Peter Cooperx)</author>
    </item>
  </channel>
</rss>
