A
Arthur Roodenburg
Hello,
I built property page shellextensions, based on the DependencyWalker sample
from Microsoft.
On some machines these shellextensions do not work. I implemented it like
this (consider the registration code):
[Guid("CB262AEB-CD12-40f6-9712-F0956048B080"), ComVisible(true)]
public class ExtensionHandler : IShellExtInit, IShellPropSheetExt
{
//implementation of Addhandler, etc
//Registration
[System.Runtime.InteropServices.ComRegisterFunctionAttribute()]
static void RegisterServer(String str1)
{
RegistryKey root = Registry.LocalMachine;
RegistryKey rk;
// For WINNT set me as an approved shellex
rk =
root.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Shell
Extensions\\Approved", true);
rk.SetValue(guid, "My Shell Extensions");
rk.Close();
root.Close();
root = Registry.ClassesRoot;
string subKey =
"dllfile\\Shellex\\PropertySheetHandlers\\MyShellExtensions";
rk = root.CreateSubKey(subKey);
rk.SetValue("", guid);
rk.Close();
root.Close();
}
I made an install program like this:
System.Runtime.InteropServices.RegistrationServices regservice = new
System.Runtime.InteropServices.RegistrationServices();
Assembly asm = Assembly.LoadFrom("XshellExtensions.dll");
regservice.RegisterAssembly(asm, AssemblyRegistrationFlags.SetCodeBase );
Which registers the assembly. I am also putting the assembly into the GAC.
My questions are: How do I exactly register the shellextensions correctly?
What is missing, and can I find any documentation about this topic?
Thanks in advance,
Arthur
I built property page shellextensions, based on the DependencyWalker sample
from Microsoft.
On some machines these shellextensions do not work. I implemented it like
this (consider the registration code):
[Guid("CB262AEB-CD12-40f6-9712-F0956048B080"), ComVisible(true)]
public class ExtensionHandler : IShellExtInit, IShellPropSheetExt
{
//implementation of Addhandler, etc
//Registration
[System.Runtime.InteropServices.ComRegisterFunctionAttribute()]
static void RegisterServer(String str1)
{
RegistryKey root = Registry.LocalMachine;
RegistryKey rk;
// For WINNT set me as an approved shellex
rk =
root.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Shell
Extensions\\Approved", true);
rk.SetValue(guid, "My Shell Extensions");
rk.Close();
root.Close();
root = Registry.ClassesRoot;
string subKey =
"dllfile\\Shellex\\PropertySheetHandlers\\MyShellExtensions";
rk = root.CreateSubKey(subKey);
rk.SetValue("", guid);
rk.Close();
root.Close();
}
I made an install program like this:
System.Runtime.InteropServices.RegistrationServices regservice = new
System.Runtime.InteropServices.RegistrationServices();
Assembly asm = Assembly.LoadFrom("XshellExtensions.dll");
regservice.RegisterAssembly(asm, AssemblyRegistrationFlags.SetCodeBase );
Which registers the assembly. I am also putting the assembly into the GAC.
My questions are: How do I exactly register the shellextensions correctly?
What is missing, and can I find any documentation about this topic?
Thanks in advance,
Arthur