Home > Articles > Programming > General Programming/Other Languages

📄 Contents

  1. Introduction
  2. Obtaining an IShellLink Instance
  3. Using IShellLink
  • Print
  • + Share This
From the author of

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:

 SL: IShellLink;
 OleCheck(CoCreateInstance(CLSID_ShellLink, nil, CLSCTX_INPROC_SERVER,
  IShellLink, SL));
 // use SL here


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.

  • + Share This
  • 🔖 Save To Your Account