Colby

Colby

  • NA
  • 1
  • 0

C# Regedit

Oct 25 2008 4:11 AM
I am trying to create a new toolbar for IE using

http://msdn.microsoft.com/en-us/library/aa753588(VS.85).aspx

This tutorial.  I am performing each of the commands in C# which seems to create the directories correctly. 


using System;
using Microsoft.Win32;
using System.Runtime.InteropServices;

class CRegInstaller
{
    public static void Main(string[] args)
    {
        Byte size = 100;
        RegistryKey ImpCat = Registry.ClassesRoot.CreateSubKey("CLSID\\{71BB7CB0-3636-4a61-A95D-64D5A1DB396D}\\Implemented Categories\\{00021494-0000-0000-C000-000000000046}");
        RegistryKey InProc = Registry.ClassesRoot.CreateSubKey("CLSID\\{71BB7CB0-3636-4a61-A95D-64D5A1DB396D}\\InProcServer32\\ThreadingModel");
        RegistryKey Instance = Registry.ClassesRoot.CreateSubKey("CLSID\\{71BB7CB0-3636-4a61-A95D-64D5A1DB396D}\\Instance");
        RegistryKey InitProp = Registry.ClassesRoot.CreateSubKey("CLSID\\{71BB7CB0-3636-4a61-A95D-64D5A1DB396D}\\Instance\\InitPropertyBag");

        RegistryKey IE = Registry.ClassesRoot.CreateSubKey("Software\\Microsoft\\Internet Explorer\\Explorer Bars\\{71BB7CB0-3636-4a61-A95D-64D5A1DB396D}");

        RegistryKey remCompCat = Registry.ClassesRoot.OpenSubKey("Component Categories");
        RegistryKey remSub1 = remCompCat.OpenSubKey("{00021493-0000-0000-C000-000000000046}", true);
        RegistryKey remSub2 = remCompCat.OpenSubKey("{00021494-0000-0000-C000-000000000046}", true);

        Instance.SetValue("CLSID", "{4D5C8C2A-D075-11d0-B416-00C04FB90376}", RegistryValueKind.String);
        InitProp.SetValue("URL", "C:\\work\\Hello.html", RegistryValueKind.String);
        IE.SetValue("BarSize", new byte{ 10 }, RegistryValueKind.Binary);

        try
        {
            remSub1.DeleteSubKey("Enum");
            remSub2.DeleteSubKey("Enum");
        }
        catch {
           
        }
    }
}

That is all of my code.  I don't care much about quality right now, I just want to see some visible results....  Modify that so that it shows some kind of a toolbar like the tutorial says it will and I will be happy.