简体   繁体   English

Windows 10 中的 SHChangeNotify 未更新快速访问项目

[英]SHChangeNotify in Windows 10 not updating Quick Access items

It seems like calling SHChangeNotify in Windows does not call an update to the items in the QuickAccess pane (or any custom-namespace folders found on the left side of Explorer).似乎在 Windows 中调用 SHChangeNotify 不会调用对快速访问窗格中的项目(或在资源管理器左侧找到的任何自定义命名空间文件夹)的更新。 Seems like expanding the tree on the left side to the folder works alright, as well as anything in the main view on the right side.似乎将左侧的树扩展到文件夹工作正常,以及右侧主视图中的任何内容。

We are calling the SHChangeNotify from ac# WPF app, though the SHChangeNotify seems to call into our DLL hook in explorer just fine for anything in the right view.我们正在从 ac# WPF 应用程序调用 SHChangeNotify,尽管 SHChangeNotify 似乎在资源管理器中调用了我们的 DLL 挂钩,对于正确视图中的任何内容都很好。 This will eventually call into a named-pipe that will hook back into our c# code to call an update to the file or folder's icon.这最终将调用一个命名管道,该管道将钩回我们的 c# 代码以调用对文件或文件夹图标的更新。

This is what we are calling from c#:这就是我们从 c# 中调用的内容:

[DllImport("shell32.dll", CharSet = CharSet.Auto)]
private static extern void SHChangeNotify(
    int wEventId,
    uint uFlags,
    IntPtr dwItem1,
    IntPtr dwItem2);

var ptr = Marshal.StringToHGlobalUni(fullPath);
SHChangeNotify((int)SHCNE.SHCNE_UPDATEITEM, (int)(SHCNF.SHCNF_PATHW | SHCNF.SHCNF_FLUSHNOWAIT), ptr, IntPtr.Zero);
Marshal.FreeHGlobal(ptr);

The Quick Access virtual folder path, as a string, is shell:::{679f85cb-0220-4080-b29b-5540cc05aab6} , (this guid name is CLSID_HomeFolder ). 快速访问虚拟文件夹路径(作为字符串)为shell:::{679f85cb-0220-4080-b29b-5540cc05aab6} (此GUID名称为CLSID_HomeFolder )。

So, you can force a refresh of all items under this virtual folder with a call to: 因此,您可以通过调用以下命令来强制刷新此虚拟文件夹下的所有项目:

SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATHW, L"shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}", NULL);

If you want to refresh only a specific set of children, just get the PIDL or the path of these items and call SHChangeNotify(SHCNE_UPDATEITEM, ...) on each. 如果只想刷新一组特定的子代,则只需获取PIDL或这些项目的路径,然后对每个子项调用SHChangeNotify(SHCNE_UPDATEITEM,...)。

是否可以在 autoit 上执行此操作?

SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATHW, L"shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}", NULL);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 以编程方式Pin \\ UnPin从Windows 10中的快速访问菜单中的文件夹 - Programatically Pin\UnPin the folder from quick access menu in windows 10 如何在Windows 10的“快速访问”部分添加文件夹? 或如何为文件夹调用Windows资源管理器上下文菜单选项? - How to add a folder to the “Quick Access” section in windows 10? OR How to call windows explorer context menu option for a folder? 如何在Windows10快速访问C#中获取所有目录的列表 - How do you get a list of all directories in Windows10 Quick Access c# Lime Video SDK-Windows10快速同步配置 - Lime Video SDK - Windows10 quick sync config 访问Windows 10离线地图 - Access Windows 10 offline maps 在Windows 10应用程序中使用图像更新辅助切片 - Updating secondary tiles with images in Windows 10 app Windows 10 ScrollIntoView() 不会滚动到列表视图中间的项目 - Windows 10 ScrollIntoView() is not scrolling to the items in the middle of a listview 访问Windows Phone 7中列表框中的项目? - Access items in listbox in windows phone 7? 加载文本文件以快速访问C#Windows Form应用程序 - loading a text file for quick access C# windows form app 在 Windows 10 上访问区域附加设置的数据 - Access data of additional settings of region on Windows 10
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM