I created a shortcut (.lnk) file on the desktop using the IShellLink interface similar to the code described at the bottom of this page.
So my assumption was that to remove this shortcut I could simply call DeleteFile on the .lnk file, but evidently it is not enough... if I do that I get a remnant of the shortcut file that looks like this:
But what is interesting is that if I browse files in the desktop folder, say with Windows Explorer, the .lnk file is not actually there. What I see is some artifact on the desktop GUI surface.
Any idea how to remove a shortcut (the way Microsoft wants it done?)
OK, per suggestion above, here's the API that needs to be called afterwards to refresh the shell:
SHChangeNotify(SHCNE_DELETE, SHCNF_PATH | SHCNF_FLUSHNOWAIT, pDeletedFilePath, NULL);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With