views:

75

answers:

2

I have tested a small shell extension referring to the article on code project. Though the whole process is quite complicated , I have some how idea what are the follwoing methodsand what do thet do.:

Initialize,DragQueryFile,GetCommandString,InvokeCommand,QueryContextMenu

But after reading through it I can not understand how Our ContextMenu Extension is being associated with .txt file.

The article explains if we will have a look inside .rgs file we can see that it create a registry entry like this:

HKCR
{
  NoRemove txtfile
  {
    NoRemove ShellEx
    {
      NoRemove ContextMenuHandlers
      {
        ForceRemove SimpleShlExt = s '{5E2121EE-0300-11D4-8D3B-444553540000}'
      }
    }
  }
}

But in actual, after following the article and writing the code , when I opened SimpleShlExt.rgs It looks something like this:

--Edit As in CodeProject--

HKCR
{

    NoRemove CLSID
    {
        ForceRemove {1E569362-E0A6-4DEA-AB1F-67D6D3DEF1A5} = s 'SimpleShExt Class'
        {

            InprocServer32 = s '%MODULE%'
            {
                val ThreadingModel = s 'Apartment'
            }

        }
    }
}

Does the registry Dynamically creating any mapping bettwen the CLSID and txtfile reg entry.

If that is the case , if I want to modify the behaviour for any other File , for example for mp3 file or drive itself and I want my Context menu to Pop-Up or displayed , then how to go about it. Because I don't know the CLSID for that.

+1  A: 

One possibility is to register your context menu for all the file extensions you want to support. The other possibility is to register your extension in the wildcard / * class. It will then be instanciated for all files. You can then decide whether the context menu should be visible for this file or not. This can be done by using the IDataObject argument of IShellExtInit::Initialize.

David Feurle
@David Feurle, If you have any Code Spinet or related article please
Subhen
@subhen I did it with regedit - so no example :P Perhaps this helps http://msdn.microsoft.com/en-us/library/cc144171%28v=VS.85%29.aspxhttp://msdn.microsoft.com/en-us/library/bb776095%28v=VS.85%29.aspx
David Feurle
A: 

You have to add the part to register with the txt file extension manually to your rgs file. Visual Studio only adds the part to register the shell extension.

Stefan