Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

441 lines
9.4 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1997 - 1999
  3. All rights reserved.
  4. Module Name:
  5. shellext.hxx
  6. Abstract:
  7. Printer shell extension header.
  8. Author:
  9. Steve Kiraly (SteveKi) 02-Feb-1997
  10. Revision History:
  11. --*/
  12. #ifndef _SHELLEXT_HXX
  13. #define _SHELLEXT_HXX
  14. /********************************************************************
  15. TClassFactory defines a shell extension class factory object.
  16. ********************************************************************/
  17. QITABLE_DECLARE(TClassFactory)
  18. class TClassFactory: public CUnknownMT<QITABLE_GET(TClassFactory)>, // MT impl. of IUnknown
  19. public IClassFactory
  20. {
  21. public:
  22. TClassFactory(
  23. VOID
  24. );
  25. ~TClassFactory(
  26. VOID
  27. );
  28. //
  29. // IUnknown methods
  30. //
  31. IMPLEMENT_IUNKNOWN()
  32. //
  33. // IClassFactory methods
  34. //
  35. STDMETHODIMP
  36. CreateInstance(
  37. LPUNKNOWN,
  38. REFIID,
  39. LPVOID *
  40. );
  41. STDMETHODIMP
  42. LockServer(
  43. BOOL
  44. );
  45. };
  46. /********************************************************************
  47. TShellExtension defines the context menu shell extension object.
  48. ********************************************************************/
  49. QITABLE_DECLARE(TShellExtension)
  50. class TShellExtension: public CUnknownMT<QITABLE_GET(TShellExtension)>, // MT impl. of IUnknown
  51. public IShellExtInit,
  52. public IContextMenu,
  53. public IShellPropSheetExt,
  54. public IDsFolderProperties,
  55. public IDsPrinterProperties,
  56. public IFindPrinter,
  57. public IPhysicalLocation,
  58. public IPrnStream,
  59. public IStream,
  60. public IPrintUIServices
  61. {
  62. public:
  63. TShellExtension(
  64. VOID
  65. );
  66. ~TShellExtension(
  67. VOID
  68. );
  69. //
  70. // IUnknown methods
  71. //
  72. IMPLEMENT_IUNKNOWN()
  73. protected:
  74. LPDATAOBJECT _lpdobj;
  75. public:
  76. /********************************************************************
  77. IShellExtInit member functions.
  78. ********************************************************************/
  79. STDMETHODIMP
  80. Initialize(
  81. LPCITEMIDLIST pidlFolder,
  82. LPDATAOBJECT lpdobj,
  83. HKEY hKeyProgID
  84. );
  85. public:
  86. /********************************************************************
  87. IShellPropSheetExt member functions.
  88. ********************************************************************/
  89. STDMETHODIMP
  90. AddPages(
  91. LPFNADDPROPSHEETPAGE lpfnAddPage,
  92. LPARAM lParam
  93. );
  94. STDMETHODIMP
  95. ReplacePage(
  96. UINT uPageID,
  97. LPFNADDPROPSHEETPAGE lpfnReplaceWith,
  98. LPARAM lParam
  99. );
  100. private:
  101. TLocationPropertySheetFrontEnd *_pLocationPropertySheet;
  102. /********************************************************************
  103. IContextMenu member functions.
  104. ********************************************************************/
  105. public:
  106. STDMETHODIMP
  107. QueryContextMenu(
  108. HMENU hMenu,
  109. UINT indexMenu,
  110. UINT idCmdFirst,
  111. UINT idCmdLast,
  112. UINT uFlags
  113. );
  114. STDMETHODIMP
  115. InvokeCommand(
  116. LPCMINVOKECOMMANDINFO lpcmi
  117. );
  118. STDMETHODIMP
  119. GetCommandString(
  120. UINT_PTR idCmd,
  121. UINT uFlags,
  122. UINT *reserved,
  123. LPSTR pszName,
  124. UINT cchMax
  125. );
  126. private:
  127. //
  128. // Context menu format enumeration.
  129. //
  130. enum {
  131. k_CMF_NORMAL,
  132. k_CMF_VERBSONLY,
  133. k_CMF_EXPLORE,
  134. k_CMF_DEFAULTONLY,
  135. kUnknown,
  136. };
  137. UINT
  138. ContextMenuFormatToNumeric(
  139. UINT uFlags
  140. ) const;
  141. BOOL
  142. bIsAddPrinterWizard(
  143. VOID
  144. ) const;
  145. BOOL
  146. bGetContextName(
  147. VOID
  148. );
  149. BOOL
  150. bGetDisplayName(
  151. LPCITEMIDLIST pidlContainer,
  152. LPCITEMIDLIST pidl,
  153. LPTSTR pszDisplayName,
  154. UINT cchSize
  155. );
  156. TCHAR _szContextName[kPrinterBufMax];
  157. UINT _cItem;
  158. public:
  159. /********************************************************************
  160. IDsFolderProperties member functions.
  161. ********************************************************************/
  162. STDMETHODIMP
  163. ShowProperties(
  164. IN HWND hwndParent,
  165. IN IDataObject *pDataObject
  166. );
  167. /********************************************************************
  168. IDsPrinterProperties member functions.
  169. ********************************************************************/
  170. STDMETHODIMP
  171. ShowProperties(
  172. IN HWND hwndParent,
  173. IN LPCTSTR pszDsPath,
  174. IN OUT PBOOL pbDisplayed
  175. );
  176. /********************************************************************
  177. IFindPrinter member functions.
  178. ********************************************************************/
  179. STDMETHODIMP
  180. FindPrinter(
  181. IN HWND hwnd,
  182. IN OUT LPTSTR pszBuffer,
  183. IN UINT *puSize
  184. );
  185. /********************************************************************
  186. IPhysicalLocation member functions.
  187. ********************************************************************/
  188. STDMETHODIMP
  189. DiscoverPhysicalLocation(
  190. VOID
  191. );
  192. STDMETHODIMP
  193. GetExactPhysicalLocation(
  194. IN OUT BSTR *pbsLocation
  195. );
  196. STDMETHODIMP
  197. GetSearchPhysicalLocation(
  198. IN OUT BSTR *pbsLocation
  199. );
  200. STDMETHODIMP
  201. GetUserPhysicalLocation(
  202. IN OUT BSTR *pbsLocation
  203. );
  204. STDMETHODIMP
  205. GetMachinePhysicalLocation(
  206. IN OUT BSTR *pbsLocation
  207. );
  208. STDMETHODIMP
  209. GetSubnetPhysicalLocation(
  210. IN OUT BSTR *pbsLocation
  211. );
  212. STDMETHODIMP
  213. GetSitePhysicalLocation(
  214. IN OUT BSTR *pbsLocation
  215. );
  216. STDMETHODIMP
  217. BrowseForLocation(
  218. IN HWND hParent,
  219. IN BSTR bsDefault,
  220. IN OUT BSTR *pbsLocation
  221. );
  222. STDMETHODIMP
  223. ShowPhysicalLocationUI(
  224. VOID
  225. );
  226. private:
  227. TPhysicalLocation *_pPhysicalLocation;
  228. TFindLocDlg *_pLocationDlg;
  229. CRefPtrCOM<IPrnStream> m_spPrnStream;
  230. CRefPtrCOM<IStream> m_spStream;
  231. HRESULT
  232. CheckToCreateStreams(
  233. VOID
  234. );
  235. /********************************************************************
  236. IPrnStream member functions.
  237. ********************************************************************/
  238. public:
  239. STDMETHODIMP
  240. BindPrinterAndFile(
  241. IN LPCTSTR pszPrinter,
  242. LPCTSTR pszFile
  243. );
  244. STDMETHODIMP
  245. StorePrinterInfo(
  246. IN DWORD Flag
  247. );
  248. STDMETHODIMP
  249. RestorePrinterInfo(
  250. IN DWORD Flag
  251. );
  252. STDMETHODIMP
  253. QueryPrinterInfo(
  254. IN PrinterPersistentQueryFlag Flag,
  255. OUT PersistentInfo *pPrstInfo
  256. );
  257. /********************************************************************
  258. IStream member functions.
  259. ********************************************************************/
  260. public:
  261. HRESULT STDMETHODCALLTYPE
  262. Read( // IMPLEMENTED
  263. VOID * pv,
  264. ULONG cb,
  265. ULONG * pcbRead
  266. );
  267. HRESULT STDMETHODCALLTYPE
  268. Write( //IMPLEMENTED
  269. VOID const* pv,
  270. ULONG cb,
  271. ULONG * pcbWritten
  272. );
  273. HRESULT STDMETHODCALLTYPE
  274. Seek( //IMPLEMENTED
  275. LARGE_INTEGER dlibMove,
  276. DWORD dwOrigin,
  277. ULARGE_INTEGER * plibNewPosition
  278. );
  279. HRESULT STDMETHODCALLTYPE
  280. SetSize(
  281. ULARGE_INTEGER nSize
  282. );
  283. HRESULT STDMETHODCALLTYPE
  284. CopyTo( //NOT_IMPLEMENTED
  285. LPSTREAM pStrm,
  286. ULARGE_INTEGER cb,
  287. ULARGE_INTEGER * pcbRead,
  288. ULARGE_INTEGER * pcbWritten
  289. );
  290. HRESULT STDMETHODCALLTYPE
  291. Commit( //NOT_IMPLEMENTED
  292. IN DWORD dwFlags
  293. );
  294. HRESULT STDMETHODCALLTYPE
  295. Revert( //NOT_IMPLEMENTED
  296. VOID
  297. );
  298. HRESULT STDMETHODCALLTYPE
  299. LockRegion( //NOT_IMPLEMENTED
  300. ULARGE_INTEGER cbOffset,
  301. ULARGE_INTEGER cbLength,
  302. DWORD dwFlags
  303. );
  304. HRESULT STDMETHODCALLTYPE
  305. UnlockRegion( //NOT_IMPLEMENTED
  306. ULARGE_INTEGER cbOffset,
  307. ULARGE_INTEGER cbLength,
  308. DWORD dwFlags
  309. );
  310. HRESULT STDMETHODCALLTYPE
  311. Stat( //NOT_IMPLEMENTED
  312. STATSTG * pStatStg,
  313. DWORD dwFlags
  314. );
  315. HRESULT STDMETHODCALLTYPE
  316. Clone( //NOT_IMPLEMENTED
  317. OUT LPSTREAM * ppStrm
  318. );
  319. /********************************************************************
  320. IPrintUIServices member functions.
  321. ********************************************************************/
  322. STDMETHODIMP
  323. GenerateShareName(
  324. LPCTSTR lpszServer,
  325. LPCTSTR lpszBaseName,
  326. LPTSTR lpszOut,
  327. int cchMaxChars
  328. );
  329. };
  330. #endif