IShellView::SelectItem 在资源管理器中创建新文件后

IShellView::SelectItem in Explorer after creating a new file

ContextMenu shell 扩展中创建文件后,如何在资源管理器中 select 文件?

我使用 IFileOperation API, and tried to use IShellView::SelectItem() in the IFileProgressSink::FinishOperations() 回调创建了文件。但是文件 selection 在再次取消 selected 之前只是短暂地闪过。我假设资源管理器注意到文件的一些更改并更新了视图。

我可以半可靠地(?)在 FinishOperations 之后等待 10 毫秒,然后调用 IShellView::SelectItem 使其工作,但是有没有更明智的方法来 select 个文件操作?

就像 Raymond Chen 在评论中解释的那样,您可以使用 SHCNF_FLUSH 等待更改。