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
,
37 public IObjectWithSite
,
38 public IShellPropSheetExt
41 /* link file formats */
49 WCHAR label
[12]; /* assume 8.3 */
55 /* data structures according to the information in the link */
76 INT iIdOpen
; /* id of the "Open" entry in the context menu */
77 CComPtr
<IUnknown
> site
;
81 LPWSTR
ShellLink_GetAdvertisedArg(LPCWSTR str
);
82 HRESULT
ShellLink_SetAdvertiseInfo(LPCWSTR str
);
83 static INT_PTR CALLBACK
SH_ShellLinkDlgProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
86 virtual HRESULT WINAPI
GetClassID(CLSID
*pclsid
);
87 virtual HRESULT WINAPI
IsDirty();
88 virtual HRESULT WINAPI
Load(LPCOLESTR pszFileName
, DWORD dwMode
);
89 virtual HRESULT WINAPI
Save(LPCOLESTR pszFileName
, BOOL fRemember
);
90 virtual HRESULT WINAPI
SaveCompleted(LPCOLESTR pszFileName
);
91 virtual HRESULT WINAPI
GetCurFile(LPOLESTR
*ppszFileName
);
94 // virtual WINAPI HRESULT GetClassID(CLSID *pclsid);
95 // virtual HRESULT WINAPI IsDirty();
96 virtual HRESULT WINAPI
Load(IStream
*stm
);
97 virtual HRESULT WINAPI
Save(IStream
*stm
, BOOL fClearDirty
);
98 virtual HRESULT WINAPI
GetSizeMax(ULARGE_INTEGER
*pcbSize
);
101 virtual HRESULT WINAPI
GetPath(LPSTR pszFile
, INT cchMaxPath
, WIN32_FIND_DATAA
*pfd
, DWORD fFlags
);
102 virtual HRESULT WINAPI
GetIDList(LPITEMIDLIST
* ppidl
);
103 virtual HRESULT WINAPI
SetIDList(LPCITEMIDLIST pidl
);
104 virtual HRESULT WINAPI
GetDescription(LPSTR pszName
,INT cchMaxName
);
105 virtual HRESULT WINAPI
SetDescription(LPCSTR pszName
);
106 virtual HRESULT WINAPI
GetWorkingDirectory(LPSTR pszDir
,INT cchMaxPath
);
107 virtual HRESULT WINAPI
SetWorkingDirectory(LPCSTR pszDir
);
108 virtual HRESULT WINAPI
GetArguments(LPSTR pszArgs
,INT cchMaxPath
);
109 virtual HRESULT WINAPI
SetArguments(LPCSTR pszArgs
);
110 virtual HRESULT WINAPI
GetHotkey(WORD
*pwHotkey
);
111 virtual HRESULT WINAPI
SetHotkey(WORD wHotkey
);
112 virtual HRESULT WINAPI
GetShowCmd(INT
*piShowCmd
);
113 virtual HRESULT WINAPI
SetShowCmd(INT iShowCmd
);
114 virtual HRESULT WINAPI
GetIconLocation(LPSTR pszIconPath
,INT cchIconPath
,INT
*piIcon
);
115 virtual HRESULT WINAPI
SetIconLocation(LPCSTR pszIconPath
,INT iIcon
);
116 virtual HRESULT WINAPI
SetRelativePath(LPCSTR pszPathRel
, DWORD dwReserved
);
117 virtual HRESULT WINAPI
Resolve(HWND hwnd
, DWORD fFlags
);
118 virtual HRESULT WINAPI
SetPath(LPCSTR pszFile
);
121 virtual HRESULT WINAPI
GetPath(LPWSTR pszFile
, INT cchMaxPath
, WIN32_FIND_DATAW
*pfd
, DWORD fFlags
);
122 // virtual HRESULT WINAPI GetIDList(LPITEMIDLIST *ppidl);
123 // virtual HRESULT WINAPI SetIDList(LPCITEMIDLIST pidl);
124 virtual HRESULT WINAPI
GetDescription(LPWSTR pszName
, INT cchMaxName
);
125 virtual HRESULT WINAPI
SetDescription(LPCWSTR pszName
);
126 virtual HRESULT WINAPI
GetWorkingDirectory(LPWSTR pszDir
, INT cchMaxPath
);
127 virtual HRESULT WINAPI
SetWorkingDirectory(LPCWSTR pszDir
);
128 virtual HRESULT WINAPI
GetArguments(LPWSTR pszArgs
,INT cchMaxPath
);
129 virtual HRESULT WINAPI
SetArguments(LPCWSTR pszArgs
);
130 // virtual HRESULT WINAPI GetHotkey(WORD *pwHotkey);
131 // virtual HRESULT WINAPI SetHotkey(WORD wHotkey);
132 // virtual HRESULT WINAPI GetShowCmd(INT *piShowCmd);
133 // virtual HRESULT WINAPI SetShowCmd(INT iShowCmd);
134 virtual HRESULT WINAPI
GetIconLocation(LPWSTR pszIconPath
,INT cchIconPath
,INT
*piIcon
);
135 virtual HRESULT WINAPI
SetIconLocation(LPCWSTR pszIconPath
,INT iIcon
);
136 virtual HRESULT WINAPI
SetRelativePath(LPCWSTR pszPathRel
, DWORD dwReserved
);
137 // virtual HRESULT WINAPI Resolve(HWND hwnd, DWORD fFlags);
138 virtual HRESULT WINAPI
SetPath(LPCWSTR pszFile
);
140 // IShellLinkDataList
141 virtual HRESULT WINAPI
AddDataBlock(void *pDataBlock
);
142 virtual HRESULT WINAPI
CopyDataBlock(DWORD dwSig
, void **ppDataBlock
);
143 virtual HRESULT WINAPI
RemoveDataBlock(DWORD dwSig
);
144 virtual HRESULT WINAPI
GetFlags(DWORD
*pdwFlags
);
145 virtual HRESULT WINAPI
SetFlags(DWORD dwFlags
);
148 virtual HRESULT WINAPI
Initialize(LPCITEMIDLIST pidlFolder
, IDataObject
*pdtobj
, HKEY hkeyProgID
);
151 virtual HRESULT WINAPI
QueryContextMenu(HMENU hmenu
, UINT indexMenu
, UINT idCmdFirst
, UINT idCmdLast
, UINT uFlags
);
152 virtual HRESULT WINAPI
InvokeCommand(LPCMINVOKECOMMANDINFO lpici
);
153 virtual HRESULT WINAPI
GetCommandString(UINT_PTR idCmd
, UINT uType
, UINT
*pwReserved
, LPSTR pszName
, UINT cchMax
);
155 // IShellPropSheetExt
156 virtual HRESULT WINAPI
AddPages(LPFNADDPROPSHEETPAGE pfnAddPage
, LPARAM lParam
);
157 virtual HRESULT WINAPI
ReplacePage(UINT uPageID
, LPFNADDPROPSHEETPAGE pfnReplacePage
, LPARAM lParam
);
160 virtual HRESULT WINAPI
SetSite(IUnknown
*punk
);
161 virtual HRESULT WINAPI
GetSite(REFIID iid
, void **ppvSite
);
163 DECLARE_REGISTRY_RESOURCEID(IDR_SHELLLINK
)
164 DECLARE_NOT_AGGREGATABLE(CShellLink
)
166 DECLARE_PROTECT_FINAL_CONSTRUCT()
168 BEGIN_COM_MAP(CShellLink
)
169 COM_INTERFACE_ENTRY2_IID(IID_IPersist
, IPersist
, IPersistFile
)
170 COM_INTERFACE_ENTRY_IID(IID_IPersistFile
, IPersistFile
)
171 COM_INTERFACE_ENTRY_IID(IID_IPersistStream
, IPersistStream
)
172 COM_INTERFACE_ENTRY_IID(IID_IShellLinkA
, IShellLinkA
)
173 COM_INTERFACE_ENTRY_IID(IID_IShellLinkW
, IShellLinkW
)
174 COM_INTERFACE_ENTRY_IID(IID_IShellLinkDataList
, IShellLinkDataList
)
175 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit
, IShellExtInit
)
176 COM_INTERFACE_ENTRY_IID(IID_IContextMenu
, IContextMenu
)
177 COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt
, IShellPropSheetExt
)
178 COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite
, IObjectWithSite
)
182 #endif // _SHELLLINK_H_