【问题标题】:How to get the method signatures for DShellFolderViewEvents如何获取 DShellFolderViewEvents 的方法签名
【发布时间】:2020-04-21 05:35:46
【问题描述】:

我正在尝试使用 ATL 接收 DShellFolderViewEvents,而我能够成功订阅的唯一方法是 DISPID_SELECTIONCHANGED。标题shdispid.h 中似乎列出了许多其他事件,但我无法触发它们。不知道我做错了什么(它可能与 ATL 相关),但我想也许我正在使用错误的签名实现事件处理函数(目前我只是在尝试不带参数的 void 函数)。问题是似乎没有描述DShellFolderViewEvents 方法的文档。有谁知道如何解决这些问题?

【问题讨论】:

  • 对 Platform SDK 的快速 grep 揭示了 shldisp.idl 中的方法签名。

标签: shell winapi com atl idispatch


【解决方案1】:

您可以查看 shell32.dll 的类型库以获取接口声明。我使用 Visual Studio 附带的 oleview.exe 打开 DLL。界面如下所示:

 [
  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();
};

【讨论】:

  • 非常感谢。标题中似乎定义了更多事件。你知道为什么你发现的东西中没有这些吗?
  • 我不知道。我从 Windows 10 操作系统上的 c:\windows\system32\ 文件夹中获取它。
  • 当我查看头文件 (shldisp.h) 时,我根本没有看到任何函数定义——只有 IDispatch 的定义。您可以使用提到的 IDL 文件 @raymondchen,或从 shell32.dll 导入的定义。
  • 哦,我误以为 DISPID_SELECTIONCHANGED 周围列出的 DISPID 也属于 DShellFolderViewEvents。那是我的错。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-11-01
  • 2017-09-25
  • 1970-01-01
  • 2011-07-31
相关资源
最近更新 更多