0

I'm a web developer with very little background in COM programming; I want to develop a property sheet to allow another department to change thumbnail photos via ADUC.

So far I have made all the scripts to register the DLL and add it to ADUC which I tested with a pre-compiled DLL I had found, so the only thing left is to actually make the DLL itself.

Through research I've found out that I need to implement the IShellExtInit and IShellPropSheetExt classes if I use C++; I'd really like to know how to do it in C# but which ever is easier to learn first would be preferable then I can try to learn the other language on my own.

Can anyone point me in the direction of some working code samples or tutorials? All I have found is more theory and I learn a lot better off of following tutorials, so it would be a great help!

I made the following shell so far please let me know if it's off but with my limited COM knowledge it's all I've written as of now.

#include "stdafx.h"

#include <ShObjIdl.h>

class PropPage : IShellExtInit, IShellPropSheetExt
{
    /////////////////////////
    //IShellExtInit methods//
    /////////////////////////

    HRESULT Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID)
    {
        return S_OK;
    }

    //////////////////////////////
    //IShellPropSheetExt methods//
    //////////////////////////////

    HRESULT AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
    {
        return S_OK;
    }

    HRESULT ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam)
    {
        return S_OK;
    }

    /////////////////
    //Misc. methods//
    /////////////////
};

P.S. I will split it up into a cpp and header when I have more but while I have no idea what I'm doing it's easier to contain it all in the cpp

jeffam217
  • 117
  • 4

2 Answers2

1

The Complete Idiot's Guide to Writing Shell Extensions - Part V explains adding pages, how to put all together and gives reference source code as well.

Adding Property Pages

If Initialize() returns S_OK, Explorer queries for a new interface, IShellPropSheetExt. IShellPropSheetExt is quite simple, with only one method that requires an implementation. [...]

The AddPages() method is the one we'll implement. ReplacePage() is only used by extensions that replace pages in Control Panel applets, so we do not need to implement it here. Explorer calls our AddPages() function to let us add pages to the property sheet that Explorer sets up.

The parameters to AddPages() are a function pointer and an LPARAM, both of which are used only by the shell. lpfnAddPageProc points to a function inside the shell that we call to actually add the pages. lParam is some mysterious value that's important to the shell. We don't mess with it, we just pass it right back to the lpfnAddPageProc function.

Community
  • 1
  • 1
Roman R.
  • 68,205
  • 6
  • 94
  • 158
0

There are sample ADUC property pages in the Platform SDK samples. I'm not sure if they're still there in the Windows 7+ SDKs. You might need to download an old (e.g. Windows 2003) SDK to get the samples. I actually think one of them might show you how to store a photo.

Brian Desmond
  • 4,473
  • 1
  • 13
  • 11