IResultData::DeleteItem 和 IResultData::DeleteAllRsltItems 返回 E_UNEXPECTED
基于 ATL 的 Visual C++ MMC 管理单元存在问题。我们有一个仅显示在范围窗格中的范围项。选择此项目后,它会使用一组结果项目填充结果窗格。
当用户选择“删除所有项目”弹出菜单命令时,我们的管理单元代码将被调用 - 首先它会执行一些工作,然后继续清除结果视图。我们想要以下行为:用户单击该菜单项,调用我们的自定义代码来执行有用的工作,然后所有项目从结果窗格中消失,范围项目保持选中状态。
我尝试了两种不同的方法来删除所有结果项。
变体 1 - 它调用 IResultData::DeleteAllRsltItems()
,返回 E_UNEXPECTED
并且项目不会被删除 - 它们只是留在那里。
VAriation 2 - 它为之前插入结果窗格中的每个项目调用 IResultData::DeleteItem()
。同样,每次调用都会返回 E_UNEXPECTED
并且项目不会被删除。
如何从 MMC 视图中正确删除所有结果项?
We have a problem with an ATL-based Visual C++ MMC snapin. We have a scope item that is only showed in the scope pane. When this item is selected it populates the result pane with a set of result items.
When the user selects "delete all items" popup menu command our snapin code is invoked - first it does some work, then proceeds to clearing the result view. We want the following behavior: the user clicks that menu item, our custom code is called to do useful work, then all items disappear from the result pane, the scope item remains selected.
I tried two variations of what to do to remove all result items.
Variation 1 - it calls IResultData::DeleteAllRsltItems()
which returns E_UNEXPECTED
and items are not removed - they just stay there.
VAriation 2 - it calls IResultData::DeleteItem()
for each item previosuly inserted into result pane. Again each call returns E_UNEXPECTED
and items are not removed.
How do I properly remove all result items from the MMC view?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们在 OnShow 处理程序中执行此操作。所有子项目都像这样删除:
然后重新添加:
这可以删除结果项目。我假设您的代码中存在另一个导致 E_UNEXPECTED 的问题。
We do this in the OnShow handler. All child items are removed like this:
Then re-added:
This works to remove the result items. I assume that you have another problem in the code that is causing the E_UNEXPECTED.