Home COM GDI+ WebBrowser Data Access

IShellLink Interface

 

CLSID_ShellLink

{00021401-0000-0000-C000-000000000046}

IID_IShellLink

{000214EE-0000-0000-C000-000000000046}

 

 

The IShellLink interface allows Shell links to be created, modified, and resolved.

 

Note  The IShellLink interface has an ANSI version (IShellLinkA) and a Unicode version (IShellLinkW). The version that will be used depends on whether you compile for ANSI or Unicode. However, Microsoft Windows 95 and Windows 98 only support IShellLinkA.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IShellLink Methods

Description

GetPath

Retrieves the path and file name of a Shell link object.

GetIDList

Retrieves the list of item identifiers for a Shell link object.

SetIDList

Sets the pointer to an item identifier list (PIDL) for a Shell link object.

GetDescription

Retrieves the description string for a Shell link object.

SetDescription

Sets the description for a Shell link object. The description can be any application-defined string.

GetWorkingDirectory

Retrieves the name of the working directory for a Shell link object.

SetWorkingDirectory

Sets the name of the working directory for a Shell link object.

GetArguments

Retrieves the command-line arguments associated with a Shell link object.

SetArguments

Sets the command-line arguments for a Shell link object.

GetHotKey

Retrieves the hot key for a Shell link object.

SetHotKey

Sets a hot key for a Shell link object.

GetShowCmd

Retrieves the show command for a Shell link object.

SetShowCmd

Sets the show command for a Shell link object. The show command sets the initial show state of the window.

GetIconLocation

Retrieves the location (path and index) of the icon for a Shell link object.

SetIconLocation

Sets the location (path and index) of the icon for a Shell link object.

SetRelativePath

Sets the relative path to the Shell link object.

Resolve

Attempts to find the target of a Shell link, even if it has been moved or renamed.

SetPath

Sets the path and file name of a Shell link object.

 

SLR_FLAGS enumeration

 

Defines flags used when calling IShellLink::Resolve

 

%SLR_NO_UI = &H1
%SLR_ANY_MATCH = &H2
%SLR_UPDATE = &H4
%SLR_NOUPDATE = &H8
%SLR_NOSEARCH = &H10
%SLR_NOTRACK = &H20
%SLR_NOLINKINFO = &H40
%SLR_INVOKE_MSI = &H80
%SLR_NO_UI_WITH_MSG_PUMP = &H101

 

 

SLGP_FLAGS enumeration

 

Defines flags used when calling IShellLink::GetPath

 

%SLGP_SHORTPATH = &H1
%SLGP_UNCPRIORITY = &H2
%SLGP_RAWPATH = &H4

 

 

WIN32_FIND_DATAW

 

TYPE WIN32_FIND_DATAW
   dwFileAttributes AS DWORD
   ftCreationTime AS FILETIME
   ftLastAccessTime AS FILETIME
   ftLastWriteTime AS FILETIME
   nFileSizeHigh AS DWORD
   nFileSizeLow AS DWORD
   dwReserved0 AS DWORD
   dwReserved1 AS DWORD
   cFileName AS STRING * %MAX_PATH * 2
   cAlternateFileName AS STRING * 14 * 2
   dummy AS WORD
END TYPE

 

 

GetPath

 

FUNCTION IShellLink_GetPath ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pszFile AS ASCIIZ _
, BYVAL cch AS LONG _
, BYREF pfd AS WIN32_FIND_DATA _
, BYVAL fFlags AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[3] USING IShellLink_GetPath (pthis, pszFile, cch, pfd, fFlags) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetIDList

 

FUNCTION IShellLink_GetIDList ( _
  BYVAL pthis AS DWORD PTR _
, BYREF ppidl AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[4] USING IShellLink_GetIDList (pthis, ppidl) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

SetIDList

 

FUNCTION IShellLink_SetIDList ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL ppidl AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[5] USING IShellLink_SetIDList (pthis, ppidl) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetDescription

 

FUNCTION IShellLink_GetDescription ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pszName AS ASCIIZ _
, BYVAL cch AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[6] USING IShellLink_GetDescription (pthis, pszName, cch) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

SetDescription

 

FUNCTION IShellLink_SetDescription ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pszName AS ASCIIZ _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[7] USING IShellLink_SetDescription (pthis, pszName) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetWorkingDirectory

 

FUNCTION IShellLink_GetWorkingDirectory ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pszDir AS ASCIIZ _
, BYVAL cch AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[8] USING IShellLink_GetWorkingDirectory (pthis, pszDir, cch) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

SetWorkingDirectory

 

FUNCTION IShellLink_SetWorkingDirectory ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pszDir AS ASCIIZ _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[9] USING IShellLink_SetWorkingDirectory (pthis, pszDir) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetArguments

 

FUNCTION IShellLink_GetArguments ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pszArgs AS ASCIIZ _
, BYVAL cch AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[10] USING IShellLink_GetArguments (pthis, pszArgs, cch) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

SetArguments

 

FUNCTION IShellLink_SetArguments ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pszArgs AS ASCIIZ _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[11] USING IShellLink_SetArguments (pthis, pszArgs) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetHotKey

 

FUNCTION IShellLink_GetHotKey ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pwHotkey AS WORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[12] USING IShellLink_GetHotKey (pthis, pwHotkey) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

SetHotKey

 

FUNCTION IShellLink_SetHotKey ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pwHotkey AS WORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[13] USING IShellLink_SetHotKey (pthis, pwHotkey) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetShowCmd

 

FUNCTION IShellLink_GetShowCmd ( _
  BYVAL pthis AS DWORD PTR _
, BYREF piShowCmd AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[14] USING IShellLink_GetShowCmd (pthis, piShowCmd) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

SetShowCmd

 

FUNCTION IShellLink_SetShowCmd ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL iShowCmd AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[15] USING IShellLink_SetShowCmd (pthis, iShowCmd) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetIconLocation

 

FUNCTION IShellLink_GetIconLocation ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pszIconPath AS ASCIIZ _
, BYVAL cch AS LONG _
, BYREF piIcon AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[16] USING IShellLink_GetIconLocation (pthis, pszIconPath, cch, piIcon) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

SetIconLocation

 

FUNCTION IShellLink_SetIconLocation ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pszIconPath AS ASCIIZ _
, BYVAL iIcon AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[17] USING IShellLink_SetIconLocation (pthis, pszIconPath, iIcon) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

SetRelativePath

 

FUNCTION IShellLink_SetRelativePath ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pszPathRel AS ASCIIZ _
, BYVAL dwReserved AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[18] USING IShellLink_SetRelativePath (pthis, pszPathRel, dwReserved) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

Resolve

 

FUNCTION IShellLink_Resolve ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL hwnd AS DWORD _
, BYVAL fFlags AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[19] USING IShellLink_Resolve (pthis, hwnd, fFlags) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

SetPath

 

FUNCTION IShellLink_SetPath ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pszFile AS ASCIIZ _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[20] USING IShellLink_SetPath (pthis, pszFile) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

IID_IshellLinkW

{000214F9-0000-0000-C000-000000000046}

 

GetPath

 

FUNCTION Proto_IShellLinkW_GetPath ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pszFile AS STRING _
, BYVAL cch AS LONG _
, BYREF pfd AS WIN32_FIND_DATAW _
, BYVAL fFlags AS DWORD _
  ) AS LONG
 

FUNCTION IShellLinkW_GetPath ( _
  BYVAL pthis AS DWORD PTR _
, BYREF strFile AS STRING _
, BYREF pfd AS WIN32_FIND_DATAW _
, BYVAL fFlags AS DWORD _
  ) AS LONG

  strName = ""
  LOCAL HRESULT AS LONG
  LOCAL bstrLen AS LONG
  LOCAL pszFile AS ASCIIZ * (%MAX_PATH * 2)
  CALL DWORD @@pthis[3] USING Proto_IShellLinkW_GetPath (pthis, VARPTR(pszFile), SIZEOF(pszFile), pfd, fFlags) TO HRESULT
  IF HRESULT = %S_OK THEN
     bstrLen = lstrlenW(pszFile)
     IF bstrlen THEN strFile = ACODE$(PEEK$(VARPTR(pszFile), bstrlen * 2))
  END IF

  FUNCTION = HRESULT

END FUNCTION

 

 

GetIDList

 

FUNCTION IShellLinkW_GetIDList ( _
  BYVAL pthis AS DWORD PTR _
, BYREF ppidl AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[4] USING IShellLinkW_GetIDList (pthis, ppidl) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

SetIDList

 

FUNCTION IShellLinkW_SetIDList ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL ppidl AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[5] USING IShellLinkW_SetIDList (pthis, ppidl) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetDescription

 

FUNCTION Proto_IShellLinkW_GetDescription ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pszName AS DWORD _
, BYVAL cch AS DWORD _
  ) AS LONG
 

FUNCTION IShellLinkW_GetDescription ( _
  BYVAL pthis AS DWORD PTR _
, BYREF strName AS STRING _
  ) AS LONG

  strName = ""
  LOCAL HRESULT AS LONG
  LOCAL bstrLen AS LONG
  LOCAL pszName AS ASCIIZ * (%MAX_PATH * 2)
  CALL DWORD @@pthis[6] USING Proto_IShellLinkW_GetDescription (pthis, VARPTR(pszName), SIZEOF(pszName)) TO HRESULT
  IF HRESULT = %S_OK THEN
     bstrLen = lstrlenW(pszName)
     IF bstrlen THEN strName = ACODE$(PEEK$(VARPTR(pszName), bstrlen * 2))
  END IF

  FUNCTION = HRESULT

END FUNCTION

 

 

SetDescription

 

FUNCTION IShellLinkW_SetDescription ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL strName AS STRING _
  ) AS LONG

  LOCAL HRESULT AS LONG

  strName = UCODE$(strName) & $NUL
  CALL DWORD @@pthis[7] USING IShellLinkW_SetDescription (pthis, strName) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetWorkingDirectory

 

FUNCTION Proto_IShellLinkW_GetWorkingDirectory ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pszDir AS DWORD _
, BYVAL cch AS LONG _
  ) AS LONG
 

FUNCTION IShellLinkW_GetWorkingDirectory ( _
  BYVAL pthis AS DWORD PTR _
, BYREF strDir AS STRING _
  ) AS LONG
 

  strDir = ""
  LOCAL HRESULT AS LONG
  LOCAL bstrLen AS LONG
  LOCAL pszDir AS ASCIIZ * (%MAX_PATH * 2)
  CALL DWORD @@pthis[8] USING Proto_IShellLinkW_GetWorkingDirectory (pthis, VARPTR(pszDir), SIZEOF(pszDir) TO HRESULT
  IF HRESULT = %S_OK THEN
     bstrLen = lstrlenW(pszDir)
     IF bstrlen THEN strDir = ACODE$(PEEK$(VARPTR(pszDir), bstrlen * 2))
  END IF

  FUNCTION = HRESULT

END FUNCTION

 

 

SetWorkingDirectory

 

FUNCTION IShellLinkW_SetWorkingDirectory ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL strDir AS STRING _
  ) AS LONG

  LOCAL HRESULT AS LONG

  strDir = UCODE$(strDir) & $NUL
  CALL DWORD @@pthis[9] USING IShellLinkW_SetWorkingDirectory (pthis, strDir) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetArguments

 

FUNCTION Proto_IShellLinkW_GetArguments ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pszArgs AS DWORD _
, BYVAL cch AS LONG _
  ) AS LONG
 

FUNCTION IShellLinkW_GetArguments ( _
  BYVAL pthis AS DWORD PTR _
, BYREF strArgs AS STRING _
  ) AS LONG

  strArgs = ""

  LOCAL HRESULT AS LONG
  LOCAL bstrLen AS LONG
  LOCAL pszArgs AS ASCIIZ * (%MAX_PATH * 2)
  CALL DWORD @@pthis[10] USING Proto_IShellLinkW_GetArguments (pthis, VARPTR(pszArgs), SIZEOF(pszArgs)) TO HRESULT
  IF HRESULT = %S_OK THEN
     bstrLen = lstrlenW(pszArgs)
     IF bstrlen THEN strArgs = ACODE$(PEEK$(VARPTR(pszArgs), bstrlen * 2))
  END IF

  FUNCTION = HRESULT

END FUNCTION

 

 

SetArguments

 

FUNCTION IShellLinkW_SetArguments ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pszArgs AS STRING _
  ) AS LONG

  LOCAL HRESULT AS LONG

  pszArgs = UCODE$(pszArgs) & $NUL
  CALL DWORD @@pthis[11] USING IShellLinkW_SetArguments (pthis, pszArgs) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetHotKey

 

FUNCTION IShellLinkW_GetHotKey ( _
  BYVAL pthis AS DWORD PTR _
, BYREF pwHotkey AS WORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[12] USING IShellLinkW_GetHotKey (pthis, pwHotkey) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

SetHotKey

 

FUNCTION IShellLinkW_SetHotKey ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pwHotkey AS WORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[13] USING IShellLinkW_SetHotKey (pthis, pwHotkey) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetShowCmd

 

FUNCTION IShellLinkW_GetShowCmd ( _
  BYVAL pthis AS DWORD PTR _
, BYREF piShowCmd AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[14] USING IShellLinkW_GetShowCmd (pthis, piShowCmd) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

SetShowCmd

 

FUNCTION IShellLinkW_SetShowCmd ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL iShowCmd AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[15] USING IShellLinkW_SetShowCmd (pthis, iShowCmd) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetIconLocation

 

FUNCTION Proto_IShellLinkW_GetIconLocation ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pszIconPath AS DWORD _
, BYVAL cch AS LONG _
, BYREF piIcon AS LONG _
  ) AS LONG
 

FUNCTION IShellLinkW_GetIconLocation ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL strIconPath AS STRING _
, BYREF piIcon AS LONG _
  ) AS LONG

  strIconPath = ""
  LOCAL HRESULT AS LONG

  LOCAL bstrLen AS LONG
  LOCAL pszIconPath AS ASCIIZ * (%MAX_PATH * 2)
  CALL DWORD @@pthis[16] USING Proto_IShellLinkW_GetIconLocation (pthis, VARPTR(pszIconPath), SIZEOF(pszIconPath), piIcon) TO HRESULT
  IF HRESULT = %S_OK THEN
     bstrLen = lstrlenW(pszIconPath)
     IF bstrlen THEN strIconPath = ACODE$(PEEK$(VARPTR(pszIconPath), bstrlen * 2))
  END IF

  FUNCTION = HRESULT

END FUNCTION

 

 

SetIconLocation

 

FUNCTION IShellLinkW_SetIconLocation ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pszIconPath AS STRING _
, BYVAL iIcon AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG

  pszIconPath = UCODE$(pszIconPath) & $NUL
  CALL DWORD @@pthis[17] USING IShellLinkW_SetIconLocation (pthis, pszIconPath, iIcon) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

SetRelativePath

 

FUNCTION IShellLinkW_SetRelativePath ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pszPathRel AS STRING _
, BYVAL dwReserved AS LONG _
  ) AS LONG

  LOCAL HRESULT AS LONG

  pszPathRel = UCODE$(pszPathRel) & $NUL
  CALL DWORD @@pthis[18] USING IShellLinkW_SetRelativePath (pthis, pszPathRel, dwReserved) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

Resolve

 

FUNCTION IShellLinkW_Resolve ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL hwnd AS DWORD _
, BYVAL fFlags AS DWORD _
  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[19] USING IShellLinkW_Resolve (pthis, hwnd, fFlags) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

SetPath

 

FUNCTION IShellLinkW_SetPath ( _
  BYVAL pthis AS DWORD PTR _
, BYVAL pszFile AS STRING _
  ) AS LONG

  LOCAL HRESULT AS LONG

  pszFile = UCODE$(pszFile) & $NUL
  CALL DWORD @@pthis[20] USING IShellLinkW_SetPath (pthis, pszFile) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

Page last updated on Sunday, 26 March 2006 10:54:33 +0100