Today I learned a new trick.
When you programmatically delete a shortcut from the Desktop folder, Windows is usually smart enough to update the Desktop and the recently used programs section of the Start Menu. But sometimes, it does not work, and you are left with a “ghost” icon.
As a regular end user, you can hit the F5 key to force a refresh of the Desktop, but for the Start Menu you are left with no alternative than killing/restarting
I was looking for a better solution for a custom installer application. And after a lot of MSDN scattering and googling around, Eureka, I finally found a magic incantation to programmatically force a refresh of the Desktop.
SHChangeNotify (SHCNE_ASSOCCHANGED, 0, 0, 0);