Shell (Namespace) Extension won't register, what am I doing wrong?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Shell (Namespace) Extension won't register, what am I doing wrong?

  1. #1
    Join Date
    Dec 2011
    Posts
    44

    Shell (Namespace) Extension won't register, what am I doing wrong?

    Hi,

    I have created a Namespace Extension (I hope so) by creating a ATL Project with MFC support as dll in Visual Studio 2010.

    Now I have a Implementation of IShellFolder:

    Code:
    // ILCShellFolder.h: Deklaration von CILCShellFolder
    
    #pragma once
    #include "resource.h"       // Hauptsymbole
    
    
    
    #include "NewNSE_i.h"
    
    
    
    #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
    #error "Singlethread-COM-Objekte werden auf der Windows CE-Plattform nicht vollständig unterstützt. Windows Mobile-Plattformen bieten beispielsweise keine vollständige DCOM-Unterstützung. Definieren Sie _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA, um ATL zu zwingen, die Erstellung von Singlethread-COM-Objekten zu unterstützen und die Verwendung eigener Singlethread-COM-Objektimplementierungen zu erlauben. Das Threadmodell in der RGS-Datei wurde auf 'Free' festgelegt, da dies das einzige Threadmodell ist, das auf Windows CE-Plattformen ohne DCOM unterstützt wird."
    #endif
    
    using namespace ATL;
    
    
    // CILCShellFolder
    
    class ATL_NO_VTABLE CILCShellFolder :
    	public CComObjectRootEx<CComSingleThreadModel>,
    	public CComCoClass<CILCShellFolder, &CLSID_ILCShellFolder>,
    	//public IDispatchImpl<IILCShellFolder, &IID_IILCShellFolder, &LIBID_NewNSELib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
    	public IShellFolder,
    	public IPersistFolder
    {
    public:
    	CILCShellFolder(){
    	}
    
    DECLARE_REGISTRY_RESOURCEID(IDR_ILCSHELLFOLDER)
    
    
    BEGIN_COM_MAP(CILCShellFolder)
    	//COM_INTERFACE_ENTRY(IILCShellFolder)
    	//COM_INTERFACE_ENTRY(IDispatch)
    	COM_INTERFACE_ENTRY(IShellFolder)
    	COM_INTERFACE_ENTRY(IPersistFolder)
    	COM_INTERFACE_ENTRY(IPersist)
    END_COM_MAP()
    
    	
    	DECLARE_PROTECT_FINAL_CONSTRUCT()
    
    	HRESULT FinalConstruct(){
    		return S_OK;
    	}
    
    	void FinalRelease(){
    	}
    
    
    
        // IShellFolder
    	STDMETHOD(BindToObject)(PCUIDLIST_RELATIVE pidl, IBindCtx *pbc, REFIID riid, void **ppvOut);
    	STDMETHOD(BindToStorage)(PCUIDLIST_RELATIVE pidl, IBindCtx *pbc, REFIID riid, void **ppvOut);
    	STDMETHOD (CompareIDs)(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2);
    	STDMETHOD (CreateViewObject)(HWND hwndOwner, REFIID riid, void **ppv);
    	STDMETHOD (EnumObjects)(HWND hwndOwner, SHCONTF grfFlags, IEnumIDList **ppenumIDList);
    	STDMETHOD (GetAttributesOf)(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, SFGAOF *rgfInOut);
        STDMETHOD (GetDisplayNameOf)(PCUITEMID_CHILD pidl, SHGDNF uFlags, STRRET *pName);
    	STDMETHOD (GetUIObjectOf)(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *rgfReserved, void **ppv);
    	STDMETHOD (ParseDisplayName)(HWND hwnd, IBindCtx *pbc, LPWSTR pszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes);
    	STDMETHOD(SetNameOf)(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCWSTR pszName, SHGDNF uFlags, PITEMID_CHILD *ppidlOut);
    
    	// IPersistFolder
    	STDMETHOD (Initialize)(LPCITEMIDLIST pidl);
    
    	// IPersist
        STDMETHOD( GetClassID)(CLSID*);
    
    	
    public:
    
    
    
    };
    
    OBJECT_ENTRY_AUTO(__uuidof(ILCShellFolder), CILCShellFolder)


    Code:
    // ILCShellFolder.cpp: Implementierung von CILCShellFolder
    
    #include "stdafx.h"
    #include "ILCShellFolder.h"
    
    
    
    STDMETHODIMP CILCShellFolder::BindToObject(PCUIDLIST_RELATIVE pidl, IBindCtx *pbc, REFIID riid, void **ppvOut){
    	MessageBox(GetDesktopWindow(), TEXT("Test"), TEXT("Test"), MB_OK);
    	return S_OK;
    }
    
    
    STDMETHODIMP CILCShellFolder::BindToStorage(PCUIDLIST_RELATIVE pidl, IBindCtx *pbc, REFIID riid, void **ppvOut){
    	MessageBox(GetDesktopWindow(), TEXT("Test"), TEXT("Test"), MB_OK);
    	return S_OK;
    }
    
    
    STDMETHODIMP CILCShellFolder::CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2){
    	MessageBox(GetDesktopWindow(), TEXT("Test"), TEXT("Test"), MB_OK);
    	return S_OK;
    }
    
    
    STDMETHODIMP CILCShellFolder::CreateViewObject(HWND hwndOwner, REFIID riid, void **ppv){
    	MessageBox(GetDesktopWindow(), TEXT("Test"), TEXT("Test"), MB_OK);
    	return S_OK;
    }
    
    
    STDMETHODIMP CILCShellFolder::EnumObjects(HWND hwndOwner, SHCONTF grfFlags, IEnumIDList **ppenumIDList){
    	MessageBox(GetDesktopWindow(), TEXT("Test"), TEXT("Test"), MB_OK);
    	return S_OK;
    }
    
    
    STDMETHODIMP CILCShellFolder::GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, SFGAOF *rgfInOut){
    	MessageBox(GetDesktopWindow(), TEXT("Test"), TEXT("Test"), MB_OK);
    	return S_OK;
    }
    
    
    STDMETHODIMP CILCShellFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl, SHGDNF uFlags, STRRET *pName){
    	MessageBox(GetDesktopWindow(), TEXT("Test"), TEXT("Test"), MB_OK);
    	return S_OK;
    }
    
    
    STDMETHODIMP CILCShellFolder::GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *rgfReserved, void **ppv){
    	MessageBox(GetDesktopWindow(), TEXT("Test"), TEXT("Test"), MB_OK);
    	return S_OK;
    }
    
    
    STDMETHODIMP CILCShellFolder::ParseDisplayName(HWND hwnd, IBindCtx *pbc, LPWSTR pszDisplayName, ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes){
    	MessageBox(GetDesktopWindow(), TEXT("Test"), TEXT("Test"), MB_OK);
    	return S_OK;
    }
    
    
    STDMETHODIMP CILCShellFolder::SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCWSTR pszName, SHGDNF uFlags, PITEMID_CHILD *ppidlOut){
    	MessageBox(GetDesktopWindow(), TEXT("Test"), TEXT("Test"), MB_OK);
    	return S_OK;
    }
    
    
    STDMETHODIMP CILCShellFolder::Initialize(LPCITEMIDLIST pidl){
    	MessageBox(GetDesktopWindow(), TEXT("Test"), TEXT("Test"), MB_OK);
    	return NULL;
    }
    
    
    
    STDMETHODIMP CILCShellFolder::GetClassID(CLSID* pClsid){
    	MessageBox(GetDesktopWindow(), TEXT("Test"), TEXT("Test"), MB_OK);
    	return S_OK;
    }

    Code:
    HKCR
    {
    	NoRemove CLSID
    	{
    		ForceRemove {2AB83D0B-097B-4F36-B84A-D65C1660E714} = s 'ILCShellFolder Class'
    		{
    			ForceRemove Programmable
    			InprocServer32 = s '%MODULE%'
    			{
    				val ThreadingModel = s 'Apartment'
    			}
    			TypeLib = s '{F7217BA8-D6D4-4307-8737-48E8A4A12723}'
    			Version = s '1.0'
    
    			DefaultIcon = s '%MODULE%,0'
    			ShellFolder
                {
                    val Attributes = d '2818572288'
                }
    		}
    	}
    }

    GUIDS:
    MIDL_DEFINE_GUID(CLSID, CLSID_ILCShellFolder,0x2AB83D0B,0x097B,0x4F36,0xB8,0x4A,0xD6,0x5C,0x16,0x60,0xE7,0x14);
    MIDL_DEFINE_GUID(CLSID, CLSID_ILCShellView,0x3B104ACE,0x4749,0x4114,0xBC,0x10,0x05,0x24,0xF4,0x02,0xF5,0x42);


    Not any of those IShellFolder Methods is being called...
    When I attach the explorer.exe process (which I know I can use to debug on other projects, just in case to exclude errors) it tells me that the DLL is not loaded by the explorer.exe process. What am I doing wrong? Can you please help me?




    Kind regards,
    Michael
    Last edited by chaos2oo2; December 13th, 2012 at 08:32 AM.

  2. #2
    Join Date
    Dec 2011
    Posts
    44

    Re: Shell (Namespace) Extension won't register, what am I doing wrong?

    I've found it out...thank you anyway!

    Code:
    HKLM
    {
        NoRemove Software
        {
            NoRemove Microsoft
            {
                NoRemove Windows
                {
                    NoRemove CurrentVersion
                    {
                        NoRemove Explorer
                        {
                            NoRemove Desktop
                            {
                                NoRemove NameSpace
                                {
                                    ForceRemove {2AB83D0B-097B-4F36-B84A-D65C1660E714}
                                    {
                                        val 'Removal Message' = s 'Something'
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    was missing as for the registration...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center