我正在编写一段代码,用于删除用户开始菜单中的额外文件夹。我首先删除它包含的所有快捷方式,然后删除文件夹本身。
完成此操作后,我可以确认快捷方式已从开始菜单中删除,但它们包含的文件夹仍保留在开始菜单中列出。因此,我检查了文件系统中是否有这样的文件夹,但没有找到。我怀疑这是某种刷新问题,因此我注销了用户并重新登录到 Vista,发现该文件夹现在已从开始菜单列表中删除。
多么烦人...有谁知道如何以编程方式强制“刷新”Vista 开始菜单,以便用户在注销之前看不到这个空文件夹?
谢谢,
-本
I am working on a piece of code that removes an extra folder we have in the user's start menu. I start by removing all of the shortcuts it contains, and then remove the folder itself.
After this is done, I can confirm that the shortcuts have been removed from the start menu, but their containing folder remains listed in the start menu. So, I checked the file system for such a folder and found none. Suspecting that this is some sort of refresh problem, I logged my user out and back into Vista and found that the folder was now removed from the start menu list.
How utterly annoying... Does anyone know how to programmatically force a 'refresh' of the Vista start menu, so that the user doesn't see this empty folder before they log out?
Thanks,
-Ben
发布评论
评论(2)
我尝试自己实现这一点,但使用 SendMessageTimeout 并没有按预期工作。
相反,当我使用时它有效
SHGetSpecialFolderLocation(CSIDL_STARTMENU)
SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_IDLIST, pidl, NULL);
有关示例 C++ 代码,请参阅这篇文章:
http://support.microsoft.com/kb/q193293/
在 Windows Server 2008 Enterprise 上测试(x86) 与 SP1。
I tried to implement this myself but it did not work as expected using SendMessageTimeout.
Instead, it worked when I used
SHGetSpecialFolderLocation(CSIDL_STARTMENU)
SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_IDLIST, pidl, NULL);
See this article for sample c++ code:
http://support.microsoft.com/kb/q193293/
Tested on Windows Server 2008 Enterprise (x86) with SP1.
本文似乎有您正在寻找的答案:
http://social.msdn.microsoft.com/forums/en-US/winforms/thread/ce540c7d-a113-4f39-956e-0af6bc91abd3/
给出的答案是:
This article seems to have the answer you're looking for:
http://social.msdn.microsoft.com/forums/en-US/winforms/thread/ce540c7d-a113-4f39-956e-0af6bc91abd3/
The answer given is: