Obtaining an IShellLink Instance
Unlike working with shell extensions, you don't implement the IShellLink interface. Instead, this interface is implemented by the Windows shell, and you use the CoCreateInstance() COM function to create an instance. Here's an example:
var SL: IShellLink; begin OleCheck(CoCreateInstance(CLSID_ShellLink, nil, CLSCTX_INPROC_SERVER, IShellLink, SL)); // use SL here end;
Don't forget that before you can use any OLE functions, you must initialize the COM library using the CoInitialize() function. When you're through using COM, you must clean up by calling CoUninitialize(). These functions will be called for you by Delphi in an application that uses ComObj and contains a call to Application.Initialize(). Otherwise, you'll have to call these functions yourself.