Delphi 6 Shell Links
Introduction
The Windows shell exposes a series of interfaces that can be employed to manipulate different aspects of the shell. These interfaces are defined in the ShlObj unit. Discussing in depth all the objects in that unit could take a whole book, so for now we'll focus on one of the most useful (and most used) interfaces: IShellLink.
IShellLink is an interface that permits creating and manipulating shell links in your applications. In case you're unsure, most of the icons on your desktop are probably shell links. Additionally, each item in the shell's local Send To menu or the Documents menu (off of the Start menu) are all shell links. The IShellLink interface is defined as follows:
const type IShellLink = interface(IUnknown) ['{000214EE-0000-0000-C000-000000000046}'] function GetPath(pszFile: PAnsiChar; cchMaxPath: Integer; var pfd: TWin32FindData; fFlags: DWORD): HResult; stdcall; function GetIDList(var ppidl: PItemIDList): HResult; stdcall; function SetIDList(pidl: PItemIDList): HResult; stdcall; function GetDescription(pszName: PAnsiChar; cchMaxName: Integer): HResult; stdcall; function SetDescription(pszName: PAnsiChar): HResult; stdcall; function GetWorkingDirectory(pszDir: PAnsiChar; cchMaxPath: Integer): HResult; stdcall; function SetWorkingDirectory(pszDir: PAnsiChar): HResult; stdcall; function GetArguments(pszArgs: PAnsiChar; cchMaxPath: Integer): HResult; stdcall; function SetArguments(pszArgs: PAnsiChar): HResult; stdcall; function GetHotkey(var pwHotkey: Word): HResult; stdcall; function SetHotkey(wHotkey: Word): HResult; stdcall; function GetShowCmd(out piShowCmd: Integer): HResult; stdcall; function SetShowCmd(iShowCmd: Integer): HResult; stdcall; function GetIconLocation(pszIconPath: PAnsiChar; cchIconPath: Integer; out piIcon: Integer): HResult; stdcall; function SetIconLocation(pszIconPath: PAnsiChar; iIcon: Integer): HResult; stdcall; function SetRelativePath(pszPathRel: PAnsiChar; dwReserved: DWORD): HResult; stdcall; function Resolve(Wnd: HWND; fFlags: DWORD): HResult; stdcall; function SetPath(pszFile: PAnsiChar): HResult; stdcall; end;