1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
{-----------------------------------------------------------------}
{ Créer un raccourci }
{-----------------------------------------------------------------}
Procedure CreFicLien(FicSource, FicRaccourci : String);
Var
PersistFile : IPersistFile;
ShellLink : IShellLink;
RaccourciWC : Array[0..MAX_PATH] of WideChar;
Begin
If UpperCase(extractFileExt(FicRaccourci))<>'.LNK' Then
FicRaccourci:=FicRaccourci+'.lnk';
ShellLink:=CreateComObject(CLSID_ShellLink) as IShellLink;
ShellLink.QueryInterface(IPersistFile, PersistFile);
ShellLink.SetDescription('');
ShellLink.SetPath(PChar(FicSource));
ShellLink.SetShowCmd(SW_SHOW);
MultiByteToWideChar(CP_ACP, 0, PChar(FicRaccourci), -1, @RaccourciWC, MAX_PATH);
PersistFile.Save(RaccourciWC, true);
End;
{-----------------------------------------------------------------}
{ Supprimer un raccourci }
{-----------------------------------------------------------------}
Procedure EffaceLien(Chemin, NomRaccourci : String);
Begin
If Chemin[Length(Chemin)] <> '\' Then Chemin:=Chemin + '\';
DeleteFile(Chemin + NomRaccourci + '.lnk');
End;
{-----------------------------------------------------------------} |
Partager