3 * Copyright 1997 Marcus Meissner
4 * Copyright 1998 Juergen Schmied
5 * Copyright 2005 Mike McCormack
6 * Copyright 2009 Andrew Hill
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 public CComCoClass
<CShellLink
, &CLSID_ShellLink
>,
29 public CComObjectRootEx
<CComMultiThreadModelNoCS
>,
33 public IPersistStream
,
34 public IShellLinkDataList
,
38 public IObjectWithSite
,
39 public IShellPropSheetExt
42 /* link file formats */
50 WCHAR label
[12]; /* assume 8.3 */
56 /* data structures according to the information in the link */
77 INT iIdOpen
; /* id of the "Open" entry in the context menu */
78 CComPtr
<IUnknown
> site
;
79 CComPtr
<IDropTarget
> mDropTarget
;
83 LPWSTR
ShellLink_GetAdvertisedArg(LPCWSTR str
);
84 HRESULT
ShellLink_SetAdvertiseInfo(LPCWSTR str
);
85 static INT_PTR CALLBACK
SH_ShellLinkDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
88 virtual HRESULT WINAPI
GetClassID(CLSID
*pclsid
);
89 virtual HRESULT WINAPI
IsDirty();
90 virtual HRESULT WINAPI
Load(LPCOLESTR pszFileName
, DWORD dwMode
);
91 virtual HRESULT WINAPI
Save(LPCOLESTR pszFileName
, BOOL fRemember
);
92 virtual HRESULT WINAPI
SaveCompleted(LPCOLESTR pszFileName
);
93 virtual HRESULT WINAPI
GetCurFile(LPOLESTR
*ppszFileName
);
96 // virtual WINAPI HRESULT GetClassID(CLSID *pclsid);
97 // virtual HRESULT WINAPI IsDirty();
98 virtual HRESULT WINAPI
Load(IStream
*stm
);
99 virtual HRESULT WINAPI
Save(IStream
*stm
, BOOL fClearDirty
);
100 virtual HRESULT WINAPI
GetSizeMax(ULARGE_INTEGER
*pcbSize
);
103 virtual HRESULT WINAPI
GetPath(LPSTR pszFile
, INT cchMaxPath
, WIN32_FIND_DATAA
*pfd
, DWORD fFlags
);
104 virtual HRESULT WINAPI
GetIDList(LPITEMIDLIST
* ppidl
);
105 virtual HRESULT WINAPI
SetIDList(LPCITEMIDLIST pidl
);
106 virtual HRESULT WINAPI
GetDescription(LPSTR pszName
,INT cchMaxName
);
107 virtual HRESULT WINAPI
SetDescription(LPCSTR pszName
);
108 virtual HRESULT WINAPI
GetWorkingDirectory(LPSTR pszDir
,INT cchMaxPath
);
109 virtual HRESULT WINAPI
SetWorkingDirectory(LPCSTR pszDir
);
110 virtual HRESULT WINAPI
GetArguments(LPSTR pszArgs
,INT cchMaxPath
);
111 virtual HRESULT WINAPI
SetArguments(LPCSTR pszArgs
);
112 virtual HRESULT WINAPI
GetHotkey(WORD
*pwHotkey
);
113 virtual HRESULT WINAPI
SetHotkey(WORD wHotkey
);
114 virtual HRESULT WINAPI
GetShowCmd(INT
*piShowCmd
);
115 virtual HRESULT WINAPI
SetShowCmd(INT iShowCmd
);
116 virtual HRESULT WINAPI
GetIconLocation(LPSTR pszIconPath
,INT cchIconPath
,INT
*piIcon
);
117 virtual HRESULT WINAPI
SetIconLocation(LPCSTR pszIconPath
,INT iIcon
);
118 virtual HRESULT WINAPI
SetRelativePath(LPCSTR pszPathRel
, DWORD dwReserved
);
119 virtual HRESULT WINAPI
Resolve(HWND hwnd
, DWORD fFlags
);
120 virtual HRESULT WINAPI
SetPath(LPCSTR pszFile
);
123 virtual HRESULT WINAPI
GetPath(LPWSTR pszFile
, INT cchMaxPath
, WIN32_FIND_DATAW
*pfd
, DWORD fFlags
);
124 // virtual HRESULT WINAPI GetIDList(LPITEMIDLIST *ppidl);
125 // virtual HRESULT WINAPI SetIDList(LPCITEMIDLIST pidl);
126 virtual HRESULT WINAPI
GetDescription(LPWSTR pszName
, INT cchMaxName
);
127 virtual HRESULT WINAPI
SetDescription(LPCWSTR pszName
);
128 virtual HRESULT WINAPI
GetWorkingDirectory(LPWSTR pszDir
, INT cchMaxPath
);
129 virtual HRESULT WINAPI
SetWorkingDirectory(LPCWSTR pszDir
);
130 virtual HRESULT WINAPI
GetArguments(LPWSTR pszArgs
,INT cchMaxPath
);
131 virtual HRESULT WINAPI
SetArguments(LPCWSTR pszArgs
);
132 // virtual HRESULT WINAPI GetHotkey(WORD *pwHotkey);
133 // virtual HRESULT WINAPI SetHotkey(WORD wHotkey);
134 // virtual HRESULT WINAPI GetShowCmd(INT *piShowCmd);
135 // virtual HRESULT WINAPI SetShowCmd(INT iShowCmd);
136 virtual HRESULT WINAPI
GetIconLocation(LPWSTR pszIconPath
,INT cchIconPath
,INT
*piIcon
);
137 virtual HRESULT WINAPI
SetIconLocation(LPCWSTR pszIconPath
,INT iIcon
);
138 virtual HRESULT WINAPI
SetRelativePath(LPCWSTR pszPathRel
, DWORD dwReserved
);
139 // virtual HRESULT WINAPI Resolve(HWND hwnd, DWORD fFlags);
140 virtual HRESULT WINAPI
SetPath(LPCWSTR pszFile
);
142 // IShellLinkDataList
143 virtual HRESULT WINAPI
AddDataBlock(void *pDataBlock
);
144 virtual HRESULT WINAPI
CopyDataBlock(DWORD dwSig
, void **ppDataBlock
);
145 virtual HRESULT WINAPI
RemoveDataBlock(DWORD dwSig
);
146 virtual HRESULT WINAPI
GetFlags(DWORD
*pdwFlags
);
147 virtual HRESULT WINAPI
SetFlags(DWORD dwFlags
);
150 virtual HRESULT WINAPI
Initialize(LPCITEMIDLIST pidlFolder
, IDataObject
*pdtobj
, HKEY hkeyProgID
);
153 virtual HRESULT WINAPI
QueryContextMenu(HMENU hmenu
, UINT indexMenu
, UINT idCmdFirst
, UINT idCmdLast
, UINT uFlags
);
154 virtual HRESULT WINAPI
InvokeCommand(LPCMINVOKECOMMANDINFO lpici
);
155 virtual HRESULT WINAPI
GetCommandString(UINT_PTR idCmd
, UINT uType
, UINT
*pwReserved
, LPSTR pszName
, UINT cchMax
);
157 // IShellPropSheetExt
158 virtual HRESULT WINAPI
AddPages(LPFNADDPROPSHEETPAGE pfnAddPage
, LPARAM lParam
);
159 virtual HRESULT WINAPI
ReplacePage(UINT uPageID
, LPFNADDPROPSHEETPAGE pfnReplacePage
, LPARAM lParam
);
162 virtual HRESULT WINAPI
SetSite(IUnknown
*punk
);
163 virtual HRESULT WINAPI
GetSite(REFIID iid
, void **ppvSite
);
166 virtual HRESULT WINAPI
DragEnter(IDataObject
*pDataObject
, DWORD dwKeyState
, POINTL pt
, DWORD
*pdwEffect
);
167 virtual HRESULT WINAPI
DragOver(DWORD dwKeyState
, POINTL pt
, DWORD
*pdwEffect
);
168 virtual HRESULT WINAPI
DragLeave();
169 virtual HRESULT WINAPI
Drop(IDataObject
*pDataObject
, DWORD dwKeyState
, POINTL pt
, DWORD
*pdwEffect
);
171 DECLARE_REGISTRY_RESOURCEID(IDR_SHELLLINK
)
172 DECLARE_NOT_AGGREGATABLE(CShellLink
)
174 DECLARE_PROTECT_FINAL_CONSTRUCT()
176 BEGIN_COM_MAP(CShellLink
)
177 COM_INTERFACE_ENTRY2_IID(IID_IPersist
, IPersist
, IPersistFile
)
178 COM_INTERFACE_ENTRY_IID(IID_IPersistFile
, IPersistFile
)
179 COM_INTERFACE_ENTRY_IID(IID_IPersistStream
, IPersistStream
)
180 COM_INTERFACE_ENTRY_IID(IID_IShellLinkA
, IShellLinkA
)
181 COM_INTERFACE_ENTRY_IID(IID_IShellLinkW
, IShellLinkW
)
182 COM_INTERFACE_ENTRY_IID(IID_IShellLinkDataList
, IShellLinkDataList
)
183 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit
, IShellExtInit
)
184 COM_INTERFACE_ENTRY_IID(IID_IContextMenu
, IContextMenu
)
185 COM_INTERFACE_ENTRY_IID(IID_IDropTarget
, IDropTarget
)
186 COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt
, IShellPropSheetExt
)
187 COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite
, IObjectWithSite
)
191 #endif /* _SHELLLINK_H_ */