' api_shell.sbp

#ifdef UNICODE
Const _FuncName_DoEnvironmentSubst = "DoEnvironmentSubstW"
Const _FuncName_DragQueryFile = "DragQueryFileW"
Const _FuncName_ExtractAssociatedIcon = "ExtractAssociatedIconW"
Const _FuncName_ExtractIcon = "ExtractIconW"
Const _FuncName_ExtractIconEx = "ExtractIconExW"
Const _FuncName_FindExecutable = "FindExecutableW"
Const _FuncName_GUIDFromString = "GUIDFromStringW"
Const _FuncName_SHBrowseForFolder = "SHBrowseForFolderW"
Const _FuncName_ShellAbout = "ShellAboutW"
Const _FuncName_ShellExecute = "ShellExecuteW"
Const _FuncName_ShellExecuteEx = "ShellExecuteExW"
Const _FuncName_Shell_NotifyIcon = "NotifyIconW"
Const _FuncName_SHEmptyRecycleBin = "SHEmptyRecycleBinW"
Const _FuncName_SHFileOperation = "SHFileOperationW"
Const _FuncName_SHGetFileInfo = "SHGetFileInfoW"
Const _FuncName_SHGetPathFromIDList = "SHGetPathFromIDListW"
Const _FuncName_SHGetSpecialFolderPath = "SHGetSpecialFolderPathW"
#else
Const _FuncName_DoEnvironmentSubst = "DoEnvironmentSubstA"
Const _FuncName_DragQueryFile = "DragQueryFileA"
Const _FuncName_ExtractAssociatedIcon = "ExtractAssociatedIconA"
Const _FuncName_ExtractIcon = "ExtractIconA"
Const _FuncName_ExtractIconEx = "ExtractIconExA"
Const _FuncName_FindExecutable = "FindExecutableA"
Const _FuncName_GUIDFromString = "GUIDFromStringA"
Const _FuncName_SHBrowseForFolder = "SHBrowseForFolderA"
Const _FuncName_ShellAbout = "ShellAboutA"
Const _FuncName_ShellExecute = "ShellExecuteA"
Const _FuncName_ShellExecuteEx = "ShellExecuteExA"
Const _FuncName_Shell_NotifyIcon = "Shell_NotifyIconA"
Const _FuncName_SHEmptyRecycleBin = "SHEmptyRecycleBinA"
Const _FuncName_SHFileOperation = "SHFileOperationA"
Const _FuncName_SHGetFileInfo = "SHGetFileInfoA"
Const _FuncName_SHGetPathFromIDList = "SHGetPathFromIDListA"
Const _FuncName_SHGetSpecialFolderPath = "SHGetSpecialFolderPathA"
#endif

Type _System_DeclareHandle_HDROP:unused As DWord:End Type
TypeDef HDROP     = *_System_DeclareHandle_HDROP

Interface IEnumIDList
	Inherits IUnknown
End Interface

'-----------
' Shell API

' shellapi.h
Declare Function DoEnvironmentSubst Lib "shell32" Alias _FuncName_DoEnvironmentSubst (
	pszString As PTSTR,
	cchString As DWord
) As DWord

' shellapi.h
Declare Sub DragAcceptFiles Lib "shell32" (hWnd As HWND, bAccept As BOOL)
Declare Sub DragFinish Lib "shell32" (hDrop As HDROP)
Declare Function DragQueryFile Lib "shell32" Alias _FuncName_DragQueryFile (hDrop As HDROP, iFile As Long, lpszFile As LPTSTR, cch As DWord) As DWord
Declare Function DragQueryPoint Lib "shell32" (hDrop As HDROP, ByRef lpPoint As POINTAPI) As Long
Declare Function ExtractAssociatedIcon Lib "shell32" Alias _FuncName_ExtractAssociatedIcon (hInst As HINSTANCE, lpIconPath As LPTSTR, lpiIcon As *Word) As HICON
' Shellapi.h
Declare Function ExtractIcon Lib "shell32" Alias _FuncName_ExtractIcon (hInst As HINSTANCE, lpszExeFileName As LPCTSTR, nIconIndex As Long) As HICON
Declare Function ExtractIconEx Lib "shell32" Alias _FuncName_ExtractIconEx (lpszFile As PCSTR, nIconIndex As Long, phiconLarge As *DWord, phiconSmall As *DWord, nIcons As Long) As HICON

' shellapi.h
Declare Function FindExecutable Lib "shell32" Alias _FuncName_FindExecutable (
	lpFile As LPCTSTR,
	lpDirectory As LPCTSTR,
	lpResult As LPCTSTR
) As Long

Declare Function GUIDFromString Lib "shell32" Alias _FuncName_GUIDFromString (
	ByVal psz As PCTSTR,
	ByRef guid As GUID
) As BOOL

' intshcut.h
Declare Function InetIsOffline Lib "url" (dwFlags As DWord) As BOOL
' intshcut.h
Declare Function MIMEAssociationDialog Lib "url" (
	hwndParent As HWND,
	dwInFlags As DWord,
	pcszFile As PCTSTR,
	pcszMIMEContentType As PCTSTR,
	pszAppBuf As PTSTR,
	ucAppBufLen As DWord
) As HRESULT

' shlobj.h
Declare Sub SHAddToRecentDocs Lib "shell32" (ByVal uFlags As Long, ByVal pv As VoidPtr)

Const ABM_NEW = &h00000000
Const ABM_REMOVE = &h00000001
Const ABM_QUERYPOS = &h00000002
Const ABM_SETPOS = &h00000003
Const ABM_GETSTATE = &h00000004
Const ABM_GETTASKBARPOS = &h00000005
Const ABM_ACTIVATE = &h00000006
Const ABM_GETAUTOHIDEBAR = &h00000007
Const ABM_SETAUTOHIDEBAR = &h00000008
Const ABM_WINDOWPOSCHANGED = &h0000009
Const ABM_SETSTATE = &h0000000a

Const ABN_STATECHANGE = &h0000000
Const ABN_POSCHANGED = &h0000001
Const ABN_FULLSCREENAPP = &h0000002
Const ABN_WINDOWARRANGE = &h0000003

Const ABS_AUTOHIDE = &h0000001
Const ABS_ALWAYSONTOP = &h0000002

Const ABE_LEFT = 0
Const ABE_TOP = 1
Const ABE_RIGHT = 2
Const ABE_BOTTOM = 3

Type APPBARDATA
	cbSize As DWord
	hWnd As HWND
	uCallbackMessage As DWord
	uEdge As DWord
	rc As RECT
	lParam As LPARAM
End Type

' shellapi.h
Declare Function SHAppBarMessage Lib "shell32" (dwMessage As DWord, ByRef Data As APPBARDATA) As ULONG_PTR

Const BIF_RETURNONLYFSDIRS =   &H0001
Const BIF_DONTGOBELOWDOMAIN =  &H0002
Const BIF_STATUSTEXT =         &H0004
Const BIF_RETURNFSANCESTORS =  &H0008
Const BIF_EDITBOX =            &H0010
Const BIF_VALIDATE =           &H0020
Const BIF_BROWSEFORCOMPUTER =  &H1000
Const BIF_BROWSEFORPRINTER =   &H2000
Const BIF_BROWSEINCLUDEFILES = &H4000

Typedef BFFCALLBACK = *Function(hwnd As HWND, uMsg As DWord, lParam As LPARAM, lpData As LPARAM) As Long

Type BROWSEINFOW
	hwndOwner      As HWND
	pidlRoot       As VoidPtr
	pszDisplayName As LPWSTR
	lpszTitle      As LPCWSTR
	ulFlags        As DWord
	lpfn           As BFFCALLBACK
	lParam         As LPARAM
	iImage         As Long
End Type
Type BROWSEINFOA
	hwndOwner      As HWND
	pidlRoot       As VoidPtr
	pszDisplayName As LPSTR
	lpszTitle      As LPCSTR
	ulFlags        As DWord
	lpfn           As BFFCALLBACK
	lParam         As LPARAM
	iImage         As Long
End Type
#ifdef UNICODE
TypeDef BROWSEINFO = BROWSEINFOW
#else
TypeDef BROWSEINFO = BROWSEINFOA
#endif

Type SHITEMID 'shtypes.h
	cb As Word
	abID[ELM(1)] As Byte
End Type

Type ITEMIDLIST 'shtypes.h
	mkid As SHITEMID
End Type

typedef LPITEMIDLIST = /*__unaligned*/ *ITEMIDLIST
typedef LPCITEMIDLIST = /*__unaligned const*/ *ITEMIDLIST

'shlobj.h
Declare Function SHBrowseForFolder Lib "shell32" Alias _FuncName_SHBrowseForFolder (ByRef bi As BROWSEINFO) As *ITEMIDLIST

Const SHCNE_RENAMEITEM          = &h00000001
Const SHCNE_CREATE              = &h00000002
Const SHCNE_DELETE              = &h00000004
Const SHCNE_MKDIR               = &h00000008
Const SHCNE_RMDIR               = &h00000010
Const SHCNE_MEDIAINSERTED       = &h00000020
Const SHCNE_MEDIAREMOVED        = &h00000040
Const SHCNE_DRIVEREMOVED        = &h00000080
Const SHCNE_DRIVEADD            = &h00000100
Const SHCNE_NETSHARE            = &h00000200
Const SHCNE_NETUNSHARE          = &h00000400
Const SHCNE_ATTRIBUTES          = &h00000800
Const SHCNE_UPDATEDIR           = &h00001000
Const SHCNE_UPDATEITEM          = &h00002000
Const SHCNE_SERVERDISCONNECT    = &h00004000
Const SHCNE_UPDATEIMAGE         = &h00008000
Const SHCNE_DRIVEADDGUI         = &h00010000
Const SHCNE_RENAMEFOLDER        = &h00020000
Const SHCNE_FREESPACE           = &h00040000

#ifdef __UNDEFINED__ '#if _WIN32_IE >= 0x0400
Const SHCNE_EXTENDED_EVENT      = &h04000000
#endif

Const SHCNE_ASSOCCHANGED        = &h08000000

Const SHCNE_DISKEVENTS          = &h0002381F
Const SHCNE_GLOBALEVENTS        = &h0C0581E0
Const SHCNE_ALLEVENTS           = &h7FFFFFFF
Const SHCNE_INTERRUPT           = &h80000000

#ifdef __UNDEFINED__ '#if _WIN32_IE >= 0x0400
Const SHCNEE_ORDERCHANGED = 2
Const SHCNEE_MSI_CHANGE = 4
Const SHCNEE_MSI_UNINSTALL = 5
#endif

Const SHCNF_IDLIST      = &h0000
Const SHCNF_PATHA       = &h0001
Const SHCNF_PRINTERA    = &h0002
Const SHCNF_DWORD       = &h0003
Const SHCNF_PATHW       = &h0005
Const SHCNF_PRINTERW    = &h0006
Const SHCNF_TYPE        = &h00FF
Const SHCNF_FLUSH       = &h1000
Const SHCNF_FLUSHNOWAIT = &h2000

#ifdef UNICODE
Const SHCNF_PATH     = SHCNF_PATHW
Const SHCNF_PRINTER  = SHCNF_PRINTERW
#else
Const SHCNF_PATH     = SHCNF_PATHA
Const SHCNF_PRINTER  = SHCNF_PRINTERA
#endif

' ShlObj.h
Declare Sub SHChangeNotify Lib "shell32" (wEventId As Long, uFlags As DWord, dwItem1 As VoidPtr, dwItem2 As VoidPtr)

' ShellApi.h
Declare Function ShellAbout Lib "shell32" Alias _FuncName_ShellAbout (hWnd As HWND, szApp As PCTSTR, szOtherStuff As PCTSTR, hIcon As HICON) As Long

Const SE_ERR_FNF =             2
Const SE_ERR_PNF =             3
Const SE_ERR_ACCESSDENIED =    5
Const SE_ERR_OOM =             8
Const SE_ERR_DLLNOTFOUND =     32
Const SE_ERR_SHARE =           26
Const SE_ERR_ASSOCINCOMPLETE = 27
Const SE_ERR_DDETIMEOUT =      28
Const SE_ERR_DDEFAIL =         29
Const SE_ERR_DDEBUSY =         30
Const SE_ERR_NOASSOC =         31
' ShellApi.h
Declare Function ShellExecute Lib "shell32" Alias _FuncName_ShellExecute (hWnd As HWND, lpOperation As LPCTSTR, lpFile As LPCTSTR, lpParameters As LPCTSTR, lpDirectory As LPCTSTR, nShowCmd As Long) As HINSTANCE

Const SEE_MASK_CLASSNAME      = &H0001
Const SEE_MASK_CLASSKEY       = &H0003
Const SEE_MASK_IDLIST         = &H0004
Const SEE_MASK_INVOKEIDLIST   = &H000C
Const SEE_MASK_ICON           = &H0010
Const SEE_MASK_HOTKEY         = &H0020
Const SEE_MASK_NOCLOSEPROCESS = &H0040
Const SEE_MASK_CONNECTNETDRV  = &H0080
Const SEE_MASK_FLAG_DDEWAIT   = &H0100
Const SEE_MASK_DOENVSUBST     = &H0200
Const SEE_MASK_FLAG_NO_UI     = &H0400

Type SHELLEXECUTEINFOA
	cbSize As DWord
	fMask As DWord
	hwnd As HWND
	lpVerb As LPCSTR
	lpFile As LPCSTR
	lpParameters As LPCSTR
	lpDirectory As LPCSTR
	nShow As Long
	hInstApp As HINSTANCE
	lpIDList As LPVOID
	lpClass As LPCSTR
	hkeyClass As HKEY
	dwHotKey As DWord
	hIcon As HANDLE
	hProcess As HANDLE
End Type
Type SHELLEXECUTEINFOW
	cbSize As DWord
	fMask As DWord
	hwnd As HWND
	lpVerb As LPCWSTR
	lpFile As LPCWSTR
	lpParameters As LPCWSTR
	lpDirectory As LPCWSTR
	nShow As Long
	hInstApp As HINSTANCE
	lpIDList As LPVOID
	lpClass As LPCWSTR
	hkeyClass As HKEY
	dwHotKey As DWord
	hIcon As HANDLE
	hProcess As HANDLE
End Type
#ifdef UNICODE
TypeDef SHELLEXECUTEINFO = SHELLEXECUTEINFOW
#else
TypeDef SHELLEXECUTEINFO = SHELLEXECUTEINFOA
#endif
TypeDef LPSHELLEXECUTEINFO = *SHELLEXECUTEINFO
Declare Function ShellExecuteEx Lib "shell32" Alias _FuncName_ShellExecuteEx (ByRef ExecInfo As SHELLEXECUTEINFO) As BOOL

Const FO_MOVE =   &H0001
Const FO_COPY =   &H0002
Const FO_DELETE = &H0003
Const FO_RENAME = &H0004
Const FOF_MULTIDESTFILES =        &H0001
Const FOF_CONFIRMMOUSE =          &H0002
Const FOF_SILENT =                &H0004
Const FOF_RENAMEONCOLLISION =     &H0008
Const FOF_NOCONFIRMATION =        &H0010
Const FOF_WANTMAPPINGHANDLE =     &H0020
Const FOF_ALLOWUNDO =             &H0040
Const FOF_FILESONLY =             &H0080
Const FOF_SIMPLEPROGRESS =        &H0100
Const FOF_NOCONFIRMMKDIR =        &H0200
Const FOF_NOERRORUI =             &H0400
Const FOF_NOCOPYSECURITYATTRIBS = &H0800
Type SHFILEOPSTRUCTW
	hwnd As HWND
	wFunc As DWord
	pFrom As PCWSTR
	pTo As PCWSTR
	fFlags As Word
	fAnyOperationsAborted As BOOL
	hNameMappings As VoidPtr
	lpszProgressTitle As LPCWSTR
End Type
Type SHFILEOPSTRUCTA
	hwnd As HWND
	wFunc As DWord
	pFrom As PCSTR
	pTo As PCSTR
	fFlags As Word
	fAnyOperationsAborted As BOOL
	hNameMappings As VoidPtr
	lpszProgressTitle As LPCSTR
End Type
#ifdef UNICODE
TypeDef SHFILEOPSTRUCT = SHFILEOPSTRUCTW
#else
TypeDef SHFILEOPSTRUCT = SHFILEOPSTRUCTA
#endif

' ShellApi.h
Declare Function SHFileOperation Lib "shell32" Alias _FuncName_SHFileOperation (ByRef FileOp As SHFILEOPSTRUCT) As Long

' ShellApi.h
Declare Sub SHFreeNameMappings Lib "shell32" (hNameMappings As HANDLE)

'SHGetDataFromIDList

'shlobj.h
Declare Function SHGetDesktopFolder Lib "shell32" (ByRef pshf As *IShellFolder) As HRESULT

Declare Function SHGetPathFromIDList Lib "shell32" Alias _FuncName_SHGetPathFromIDList (pidl As *ITEMIDLIST, pszPath As PTSTR) As Long

' ShellApi.h
Declare Function SHEmptyRecycleBin Lib "shell32" Alias _FuncName_SHEmptyRecycleBin (hwnd As HWND, pszRootPath As LPCTSTR, dwFlags As DWord) As HRESULT

' ShlObj.h

'—vIE4
Declare Function SHGetSpecialFolderPath Lib "shell32" Alias _FuncName_SHGetSpecialFolderPath (hwndOwner As HWND, lpszPath As LPTSTR, nFolder As Long, fCreate As BOOL) As BOOL

' shlobj.h
Declare Function SHGetInstanceExplorer Lib "shell32" (ByRef ppunk As *IUnknown) As HRESULT

'shlobj.h
Declare Function SHGetSpecialFolderLocation Lib "shell32" (hwndOwner As HWND, nFolder As Long, ByRef pidl As LPITEMIDLIST) As HRESULT

'shlobj.h
'—vWin2k/Me
'Declare Function SHGetFolderLocation Lib "shell32" (hwndOwner As HWND, nFolder As Long, hToken As HANDLE, dwReserved As DWord, ByRef pidl As LPITEMIDLIST) As HRESULT

Const CSIDL_DESKTOP = &h0000
Const CSIDL_INTERNET = &h0001
Const CSIDL_PROGRAMS = &h0002
Const CSIDL_CONTROLS = &h0003
Const CSIDL_PRINTERS = &h0004
Const CSIDL_PERSONAL = &h0005
Const CSIDL_FAVORITES = &h0006
Const CSIDL_STARTUP = &h0007
Const CSIDL_RECENT = &h0008
Const CSIDL_SENDTO = &h0009
Const CSIDL_BITBUCKET = &h000a
Const CSIDL_STARTMENU = &h000b
Const CSIDL_MYMUSIC = &h000d
Const CSIDL_DESKTOPDIRECTORY = &h0010
Const CSIDL_DRIVES = &h0011
Const CSIDL_NETWORK = &h0012
Const CSIDL_NETHOOD = &h0013
Const CSIDL_FONTS = &h0014
Const CSIDL_TEMPLATES = &h0015
Const CSIDL_COMMON_STARTMENU = &h0016
Const CSIDL_COMMON_PROGRAMS = &h0017
Const CSIDL_COMMON_STARTUP = &h0018
Const CSIDL_COMMON_DESKTOPDIRECTORY = &h0019
Const CSIDL_APPDATA = &h001a
Const CSIDL_PRINTHOOD = &h001b
Const CSIDL_LOCAL_APPDATA = &h001c
Const CSIDL_ALTSTARTUP = &h001d
Const CSIDL_COMMON_ALTSTARTUP = &h001e
Const CSIDL_COMMON_FAVORITES = &h001f
Const CSIDL_INTERNET_CACHE = &h0020
Const CSIDL_COOKIES = &h0021
Const CSIDL_HISTORY = &h0022
Const CSIDL_COMMON_APPDATA = &h0023
Const CSIDL_WINDOWS = &h0024
Const CSIDL_SYSTEM = &h0025
Const CSIDL_PROGRAM_FILES = &h0026
Const CSIDL_MYPICTURES = &h0027
Const CSIDL_PROFILE = &h0028
Const CSIDL_PROGRAM_FILES_COMMON = &h002b
Const CSIDL_COMMON_TEMPLATES = &h002d
Const CSIDL_COMMON_DOCUMENTS = &h002e
Const CSIDL_COMMON_ADMINTOOLS = &h002f
Const CSIDL_ADMINTOOLS = &h0030

Const SHGFI_ICON              = &H000000100
Const SHGFI_DISPLAYNAME       = &H000000200
Const SHGFI_TYPENAME          = &H000000400
Const SHGFI_ATTRIBUTES        = &H000000800
Const SHGFI_ICONLOCATION      = &H000001000
Const SHGFI_EXETYPE           = &H000002000
Const SHGFI_SYSICONINDEX      = &H000004000
Const SHGFI_LINKOVERLAY       = &H000008000
Const SHGFI_SELECTED          = &H000010000
Const SHGFI_ATTR_SPECIFIED    = &H000020000
Const SHGFI_LARGEICON         = &H000000000
Const SHGFI_SMALLICON         = &H000000001
Const SHGFI_OPENICON          = &H000000002
Const SHGFI_SHELLICONSIZE     = &H000000004
Const SHGFI_PIDL              = &H000000008
Const SHGFI_USEFILEATTRIBUTES = &H000000010
Const SHGFI_ADDOVERLAYS       = &H000000020
Const SHGFI_OVERLAYINDEX      = &H000000040

' ShellApi.h
Type SHFILEINFO
	hIcon As HICON
	iIcon As Long
	dwAttributes As DWord
	szDisplayName[ELM(MAX_PATH)] As TCHAR
	szTypeName[ELM(80)] As TCHAR
End Type

' shellapi.h
Declare Function SHGetFileInfo Lib "shell32" Alias _FuncName_SHGetFileInfo (pszPath As LPCTSTR, dwFileAttributes As DWord, ByRef sfi As SHFILEINFO, cbFileInfo As DWord, uFlags As DWord) As ULONG_PTR

Type NOTIFYICONDATAW
	cbSize As DWord
	hWnd As HWND
	uID As DWord
	uFlags As DWord
	uCallbackMessage As DWord
	hIcon As HICON
	szTip[ELM(64)] As WCHAR
	dwState As DWord
	dwStateMask As DWord
	szInfo[ELM(256)] As WCHAR
	'Union
		uTimeout As DWord
	'	uVersion As DWord
	'End Union
	szInfoTitle[ELM(64)] As WCHAR
	dwInfoFlags As DWord
	guidItem As GUID
End Type
Type NOTIFYICONDATAA
	cbSize As DWord
	hWnd As HWND
	uID As DWord
	uFlags As DWord
	uCallbackMessage As DWord
	hIcon As HICON
	szTip[ELM(64)] As SByte
	dwState As DWord
	dwStateMask As DWord
	szInfo[ELM(256)] As SByte
	'Union
		uTimeout As DWord
	'	uVersion As DWord
	'End Union
	szInfoTitle[ELM(64)] As SByte
	dwInfoFlags As DWord
	guidItem As GUID
End Type
#ifdef UNICODE
TypeDef NOTIFYICONDATA = NOTIFYICONDATAW
#else
TypeDef NOTIFYICONDATA = NOTIFYICONDATAA
#endif
Declare Function Shell_NotifyIcon Lib "shell32" Alias _FuncName_Shell_NotifyIcon (dwMessage As DWORD, ByRef data As NOTIFYICONDATA) As BOOL

Type STRRET 'shtypes.h
	uType As DWord
	'Union
		'pOleStr As *WCHAR
		'uOffset As DWord
		cStr[ELM(MAX_PATH)] As Byte
	'End Union
End Type

' shobjidl.h
Enum SLGP_FLAGS
	SLGP_SHORTPATH = &h1
	SLGP_UNCPRIORITY = &h2
	SLGP_RAWPATH = &h4
	SLGP_RELATIVEPRIORITY = &h8
End Enum

Interface IShellLinkA 'shobjidl.h
	Inherits IUnknown

	Function GetPath(
		/* [size_is][out] */ pszFile As PSTR,
		/* [in] */ cch As Long,
		/* [full][out][in] */ pfd As *WIN32_FIND_DATAA,
		/* [in] */ fFlags As DWord) As HRESULT
	Function GetIDList(
		/* [out] */ ByRef ppidl As LPITEMIDLIST) As HRESULT
	Function SetIDList(
		/* [in] */ pidl As LPCITEMIDLIST) As HRESULT
	Function GetDescription(
		/* [size_is][out] */ pszName As PSTR,
		/* [in] */ cch As Long) As HRESULT
	Function SetDescription(
		/* [in] */ pszName As PCSTR) As HRESULT
	Function GetWorkingDirectory(
		/* [size_is][out] */ pszDir As PSTR,
		/* [in] */ cch As Long) As HRESULT
	Function SetWorkingDirectory(
		/* [in] */ pszDir As PCSTR) As HRESULT
	Function GetArguments(
		/* [size_is][out] */ pszArgs As PSTR,
		/* [in] */ cch As Long) As HRESULT
	Function SetArguments(
		/* [in] */ pszArgs As PCSTR) As HRESULT
	Function GetHotkey(
		/* [out] */ ByRef wHotkey As Word) As HRESULT
	Function SetHotkey(
		/* [in] */ wHotkey As Word) As HRESULT
	Function GetShowCmd(
		/* [out] */ ByRef piShowCmd As Long) As HRESULT
	Function SetShowCmd(
		/* [in] */ iShowCmd As Long) As HRESULT
	Function GetIconLocation(
		/* [size_is][out] */ pszIconPath As PSTR,
		/* [in] */ cch As Long,
		/* [out] */ ByRef iIcon As Long) As HRESULT
	Function SetIconLocation(
		/* [in] */ pszIconPath As PCSTR,
		/* [in] */ iIcon As Long) As HRESULT
	Function SetRelativePath(
		/* [in] */ pszPathRel As PCSTR,
		/* [in] */ dwReserved As DWord) As HRESULT
	Function Resolve(
		/* [in] */ hwnd As HWND,
		/* [in] */ fFlags As DWord) As HRESULT
	Function SetPath(
		/* [in] */ pszFile As PCSTR) As HRESULT
End Interface

Interface IShellLinkW 'shobjidl.h
	Inherits IUnknown

	Function GetPath(
		/* [size_is][out] */ pszFile As PWSTR,
		/* [in] */ cch As Long,
		/* [full][out][in] */ pfd As *WIN32_FIND_DATAW,
		/* [in] */ fFlags As DWord) As HRESULT
	Function GetIDList(
		/* [out] */ ppidl As *LPITEMIDLIST) As HRESULT
	Function SetIDList(
		/* [in] */ pidl As LPCITEMIDLIST) As HRESULT
	Function GetDescription(
		/* [size_is][out] */ pszName As PWSTR,
		/* [in] */ cch As Long) As HRESULT
	Function SetDescription(
		/* [in] */ pszName As PCWSTR) As HRESULT
	Function GetWorkingDirectory(
		/* [size_is][out] */ pszDir As PSTR,
		/* [in] */ cch As Long) As HRESULT
	Function SetWorkingDirectory(
		/* [in] */ pszDir As PCWSTR) As HRESULT
	Function GetArguments(
		/* [size_is][out] */ pszArgs As PSTR,
		/* [in] */ cch As Long) As HRESULT
	Function SetArguments(
		/* [in] */ pszArgs As PCWSTR) As HRESULT
	Function GetHotkey(
		/* [out] */ ByRef wHotkey As Word) As HRESULT
	Function SetHotkey(
		/* [in] */ wHotkey As Word) As HRESULT
	Function GetShowCmd(
		/* [out] */ ByRef piShowCmd As Long) As HRESULT
	Function SetShowCmd(
		/* [in] */ iShowCmd As Long) As HRESULT
	Function GetIconLocation(
		/* [size_is][out] */ pszIconPath As PWSTR,
		/* [in] */ cch As Long,
		/* [out] */ ByRef iIcon As Long) As HRESULT
	Function SetIconLocation(
		/* [in] */ pszIconPath As PCWSTR,
		/* [in] */ iIcon As Long) As HRESULT
	Function SetRelativePath(
		/* [in] */ pszPathRel As PCWSTR,
		/* [in] */ dwReserved As DWord) As HRESULT
	Function Resolve(
		/* [in] */ hwnd As HWND,
		/* [in] */ fFlags As DWord) As HRESULT
	Function SetPath(
		/* [in] */ pszFile As PCWSTR) As HRESULT
End Interface

#ifdef UNICODE
TypeDef IShellLink = IShellLinkW
#else
TypeDef IShellLink = IShellLinkA
#endif

Enum SHCONT
	SHCONTF_FOLDERS = &h0020
	SHCONTF_NONFOLDERS = &h0040
	SHCONTF_INCLUDEHIDDEN = &h0080
	SHCONTF_INIT_ON_FIRST_NEXT = &h0100
	SHCONTF_NETPRINTERSRCH = &h0200
	SHCONTF_SHAREABLE = &h0400
	SHCONTF_STORAGE = &h0800
End Enum

Enum SHGNO
	SHGDN_NORMAL = &h0000
	SHGDN_INFOLDER = &h0001
	SHGDN_FOREDITING = &h1000
	SHGDN_FORADDRESSBAR = &h4000
	SHGDN_FORPARSING = &h8000
End Enum

TypeDef SHCONTF = DWord
TypeDef SFGAOF = DWord
TypeDef SHGDNF = DWord

Dim IID_IShellFolder = [&h000214E6, 0, 0, [&hC0, 0, 0, 0, 0, 0, 0, &h46]] As IID
Interface IShellFolder 'shobjidl.h
	Inherits IUnknown

	Function ParseDisplayName(
		/* [in] */ hwnd As HWND,
		/* [in] */ pbc As *IBindCtx,
		/* [string][in] */ pszDisplayName As LPOLESTR,
		/* [out] */ pchEaten As *DWord,
		/* [out] */ ByRef pidl As *ITEMIDLIST,
		/* [unique][out][in] */ pdwAttributes As *DWord) As HRESULT
	Function EnumObjects(
		/* [in] */ hwnd As HWND,
		/* [in] */ grfFlags As SHCONTF,
		/* [out] */ ByRef penumIDList As *IEnumIDList) As HRESULT
	Function BindToObject(
		/* [in] */ pidl As *ITEMIDLIST,
		/* [in] */ pbc As *IBindCtx,
		/* [in] */ ByRef riid As IID,
		/* [iid_is][out] */ ppv As *VoidPtr) As HRESULT
	Function BindToStorage(
		/* [in] */ pidl As *ITEMIDLIST,
		/* [in] */ pbc As *IBindCtx,
		/* [in] */ ByRef riid As IID,
		/* [iid_is][out] */ ppv As *VoidPtr) As HRESULT
	Function CompareIDs(
		/* [in] */ lParam As LPARAM,
		/* [in] */ pidl1 As *ITEMIDLIST,
		/* [in] */ pidl2 As *ITEMIDLIST) As HRESULT
	Function CreateViewObject(
		/* [in] */ hwndOwner As HWND,
		/* [in] */ ByRef riid As IID,
		/* [iid_is][out] */ ppv As *VoidPtr) As HRESULT
	Function GetAttributesOf(
		/* [in] */ cidl As DWord,
		/* [size_is][in] */ apidl As *ITEMIDLIST,
		/* [out][in] */ ByRef rgfInOut As SFGAOF) As HRESULT
	Function GetUIObjectOf(
		/* [in] */ hwndOwner As HWND,
		/* [in] */ cidl As DWord,
		/* [size_is][in] */ apidl As *ITEMIDLIST,
		/* [in] */ ByRef riid As IID,
		/* [unique][out][in] */ rgfReserved As *DWord,
		/* [iid_is][out] */ ppv As *VoidPtr) As HRESULT
	Function GetDisplayNameOf(
		/* [in] */ pidl As *ITEMIDLIST,
		/* [in] */ uFlags As SHGDNF,
		/* [out] */ ByRef pName As STRRET) As HRESULT
	Function SetNameOf(
		/* [in] */ hwnd As HWND,
		/* [in] */ pidl As *ITEMIDLIST,
		/* [string][in] */ pszName As LPCWSTR,
		/* [in] */ uFlags As SHGDNF,
		/* [out] */ ByRef ppidlOut As LPITEMIDLIST) As HRESULT
End Interface
