Reputation: 3637
I need to notify Windows Explorer to refresh its Recycle Bin ICON after programmatically deleting its contents so that it will show the empty recycle bin icon. How do I do that in using vc++.
Upvotes: 0
Views: 390
Reputation: 37202
Shell32.dll exports a function called SHUpdateRecycleBinIcon
which does just what it says. This function isn't documented but you can call it like this:
typedef void (WINAPI* PFNSHUPDATERECYCLEBINICON)();
PFNSHUPDATERECYCLEBINICON pfnFunc = (PFNSHUPDATERECYCLEBINICON)GetProcAddress(GetModuleHandle(L"shell32.dll"), "SHUpdateRecycleBinIcon");
if (pfnFunc) pfnFunc();
I'd take note of other comments though that deleting things from the recycle bin yourself isn't probably best practice (and nor, of course, is using undocumented functions).
Upvotes: 3
Reputation: 3320
Let me guess: You are emptying it by manually removing the files inside the actual recycle bin folder?
Have you tried SHEmptyRecycleBin?
This is the call Windows Explorer uses to empty the bin, it should take care of the icon ;)
Upvotes: 3