Shell extensions

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
 
M

Mattias Sjögren

Arthur,
On some machines these shellextensions do not work.

Can you be a bit more specific about what, exactly, doesn't work? Are
you sure the failure is related to registration?



Mattias
 
A

Arthur Roodenburg

I think it has something to do with the registration, since AddPages is not
invoked. Strange thing is that on my development machine it actually works
fine (since I started with the sample, I think something is registered that
I forgot later on, but I couldn't find out what). On all other machines,
AddPages is not invoked.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top