所以我正在遵循这个教程:
https://msdn.microsoft.com/en-us/library/windows/desktop/hh127427(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/hh127427(v=vs.85).aspx
当我偶然发现“调用 SHChangeNotify 函数”这句话时。我该怎么做呢? powershell 无法识别它。我是否必须在 C++ 中导入一些库并从 C++ 程序中调用它?我在 Windows 10 上。
我使用以下 C# 代码从 powershell 调用桌面刷新:
$code = @'
[System.Runtime.InteropServices.DllImport("Shell32.dll")]
private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
public static void Refresh() {
SHChangeNotify(0x8000000, 0x1000, IntPtr.Zero, IntPtr.Zero);
}
'@
Add-Type -MemberDefinition $code -Namespace WinAPI -Name Explorer
[WinAPI.Explorer]::Refresh()
希望这对仍在寻找答案的人有所帮助,因为 SimonS 提供的链接似乎不再有效。
附注这就是我的想法的来源IDERA - 刷新图标缓存 http://community.idera.com/powershell/powertips/b/tips/posts/refreshing-icon-cache
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)