Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Jun : Create shortcut on Vista
| Subject: | Create shortcut on Vista |
| Posted by: | "Carlos Matos" (mat..@comograma.pt) |
| Date: | Thu, 14 Jun 2007 18:51:36 |
On Windows XP, I'm creating a startup shortcut with this procedure:
procedure CreateShortcut(Const ShortCurName, FileName, Arguments: String);
var
MyObject : IUnknown;
MySLink : IShellLink;
MyPFile : IPersistFile;
WFileName : WideString;
begin
MyObject := CreateComObject(CLSID_ShellLink);
MySLink := MyObject as IShellLink;
MyPFile := MyObject as IPersistFile;
MySLink.SetArguments(PChar(Argumentos));
MySLink.SetPath(PChar(AFileName));
MySLink.SetWorkingDirectory(PChar(ExtractFilePath(AFileName)));
WFileName := ALocation;
MyPFile.Save(PWChar(WFileName), False);
end;
When I do this on Windows Vista, the shortcut is blocked
by Windows.
Why is that? Any ideas?
Carlos