shellwinapicomatlidispatch

How to get the method signatures for DShellFolderViewEvents


I'm trying to sink DShellFolderViewEvents using the ATL, and the only method I've been able to successfully subscribe to is DISPID_SELECTIONCHANGED. There appear to be many other events listed in the header shdispid.h, but I can't get them to fire. Not sure what I'm doing wrong (it might be ATL-related), but I thought perhaps I'm implementing event-handler functions with the wrong signatures (currently I'm just trying void functions with no arguments). The problem is that there doesn't appear to be documentation describing the DShellFolderViewEvents methods. Anyone know how to figure those out?


Solution

  • You can look at the type library for shell32.dll to get the interface declaration. I used oleview.exe which comes with Visual Studio to open the DLL. The interface looks something like this:

     [
      uuid(62112AA2-EBE4-11CF-A5FB-0020AFE7292D),
      helpstring("Event interface for ShellFolderView")
    ]
    dispinterface DShellFolderViewEvents {
        properties:
        methods:
            [id(0x000000c8), helpstring("The Selection in the view changed.")]
            void SelectionChanged();
            [id(0x000000c9), helpstring("The folder has finished enumerating (flashlight is gone).")]
            void EnumDone();
            [id(0x000000ca), helpstring("A verb was invoked on an items in the view (return false to cancel).")]
            VARIANT_BOOL VerbInvoked();
            [id(0x000000cb), helpstring("the default verb (double click) was invoked on an items in the view (return false to cancel).")]
            VARIANT_BOOL DefaultVerbInvoked();
            [id(0x000000cc), helpstring("user started to drag an item (return false to cancel).")]
            VARIANT_BOOL BeginDrag();
    };