0

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?

1 Answers1

1

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();
};
Joseph Willcoxson
  • 5,853
  • 1
  • 15
  • 29
  • Thank you very much. There appear to be many more events defined in the header. Do you know why those might not be present in what you found? –  Jan 02 '20 at 15:17
  • I have no idea. I am getting it from c:\windows\system32\ folder on my windows 10 OS. – Joseph Willcoxson Jan 02 '20 at 15:19
  • When I looked in a header file (shldisp.h), I did not see any function definitions at all--just definitions for IDispatch. You can use the IDL file @raymondchen mentioned, or definitions imported from shell32.dll. – Joseph Willcoxson Jan 02 '20 at 15:31
  • Oh, I mistakenly thought the DISPIDs listed around DISPID_SELECTIONCHANGED also belonged to DShellFolderViewEvents. That's my bad. –  Jan 02 '20 at 19:15