Parceiros Wgets downloads
Inclua ActiveX, ComObj e ShlObj na clausula USES. Veja os eventos do form codificados abaixo: procedure TFMain.FormCreate(Sender: TObject); var ItemIDList : PItemIDList; begin SetLength(DirDesktop,MAX_PATH); SHGetSpecialFolderLocation(Application.Handle, CSIDL_DESKTOPDIRECTORY,ItemIDList); SHGetPathFromIDList(ItemIdList,PChar(DirDesktop)); SetLength(DirDesktop,StrLen(PChar(DirDesktop))); end; procedure TFMain.BitBtn1Click(Sender: TObject); var ShellLink : IShellLink; PersistFile : IPersistFile; NomeLnk : WideString; begin ShellLink := CreateComObject(CLSID_ShellLink) as IShellLink; PersistFile := ShellLink as IPersistFile; with ShellLink do begin // Informe o Título do ícone SetDescription(PChar('DESCRIÇÃO DO ATALHO')); // Informe o Caminho e o Arquivo SetPath(PChar('C:PASTAARQUIVO.EXE')); // Argumentos para linha de comando, caso existam SetArguments(PChar('')); // Informe o Caminho e o Arquivo SetWorkingDirectory(PChar(ExtractFilePath('C:PASTAARQUIVO.EXE'))); end; // Informe o nome do Atalho NomeLnk := DirDesktop+''+ChangeFileExt('DESCRIÇÃO DO ATALHO','.lnk'); PersistFile.Save(PWideChar(NomeLnk),False); end;