开发者

C# Refresh Explorer

开发者 https://www.devze.com 2022-12-09 13:48 出处:网络
In my program I toggle the registry value of hidden files to tell explorer whether to hide or show them.However, since explorer doesn\'t refresh on it\'s own, I send the event

In my program I toggle the registry value of hidden files to tell explorer whether to hide or show them. However, since explorer doesn't refresh on it's own, I send the event

 SHChangeNotify(0x8000000, 0x1000, IntPtr.Zero, IntPtr.Zero);

to refresh everything. However, it doesn't seem to be refreshing anything unfortunately. I see the screen on the desktop flicker a bit, but in order to s开发者_运维知识库ee the changes, I have to manually refresh the folder. SHChangeNotify doesn't seem to be working for me. Any help would be greatly appreciated.


Try SHGetSetSettings with your change to fShowAllObjects

A simple Get and Set with SHGetSetSettings won't work though.

It's smart enough to compare it's current settings to what your sending it and will only notify other windows of the change if the two are different.

To refresh the desktop use IShellWindows to enumerate shell windows, check the IWebBrowser2.FullName property to skip IE windows and then call IWebBrowser2::Refresh.

0

精彩评论

暂无评论...
验证码 换一张
取 消