【问题标题】:An InvokeCommand is not called in shell extension dll of windows 7 x64Windows 7 x64 的 shell 扩展 dll 中未调用 InvokeCommand
【发布时间】:2014-03-31 21:44:38
【问题描述】:

我的 shell 扩展代码在 Windows 7 下运行良好。 但是,在 Windows server 2008x64 或 windows 7x64 中,当 Selected Files 的数量超过 16 个时,不会调用调用的命令函数。

当所选文件的数量低于17时,一切正常; 调用顺序:QueryContextMenu -> Initialize -> GetCommandString -> InvokeCommand

但是,当 Selected Files 的数量超过 16 个时,InvokeCommand 不会被调用; 调用顺序:

 Initialize(the returned value of DragQueryFile is 16) 
    -> QueryContextMenu
    -> GetCommandString(the returned value of DragQueryFile is 16) 
    -> Initialize(the returned value of DragQueryFile is the selected file count) 
    -> QueryContextMenu -> Initialize(the returned value of DragQueryFile is only one)
    -> not call InvokeCommand

.

怎么了? 请帮帮我!!

【问题讨论】:

    标签: windows shell


    【解决方案1】:

    我遇到了同样的问题!当您在 QueryContextMenu 中返回错误结果时,永远不会调用 InvokeCommand。这意味着您必须返回最后一个项目 ID 加一(这将是下一个命令 ID)

    也就是说,如果你有方法

    public int QueryContextMenu(
            IntPtr hMenu,
            uint iMenu,
            uint idCmdFirst,
            uint idCmdLast,
            uint uFlags)
    

    你得到 idCmdFirst = 38080 作为输入参数。然后添加 1 个菜单项。 idCmdFirst 递增到 38081。如果添加 5 个项目,则必须为每个项目递增。

    在此方法结束时,您会返回以下内容:

     return WinError.MAKE_HRESULT(WinError.SEVERITY_SUCCESS, 0, (idCmdActual - idCmdFirst) + 1);
    

    这将是 (38081 - 38080) +1。 然后调用 InvokeCommand!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-03
      • 2011-08-27
      • 2012-09-01
      • 2011-08-08
      • 1970-01-01
      • 2012-11-24
      • 2016-03-14
      • 1970-01-01
      相关资源
      最近更新 更多