Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to delete a shortcut with C++

Status
Not open for further replies.

commi

Programmer
Joined
Sep 22, 2003
Messages
4
Location
CA
I have looked at iShellLink and iPersistFile interfaces but see no API for removing a shortcut. Any help is appreciated here.
 
use the same API as for deleting ordinary files. You know what a shortcut is something like an ordinary file.
DeleteFile(
LPCTSTR lpFileName //put there file name of the shortcut
);


Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
P.S. instead of something I;d say same thing

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
Hmmm... have not actually tried this but i would think you could just delete the .lnk file that the Shell created for you. That is all there is to the shortcuts i believe.

-pete
 
I have tried CFileFind and it does not recognize links, nor does remove, so links are not the same as regular files. Also, you need to use COM to create one from what I have read. I'll look at DeleteFile to see if it works, but I am sceptical at this point.
 
Look, if you have a shortcut named xxxx, the sortcut's file name is xxxx.lnk.
TO delete shortcut xxxx, use
DeleteFile("xxxx.lnk");

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
Ok, i tried it, DeleteFile() works as expected. It's just a file.

-pete
 
Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top