Leaked source code of windows server 2003
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.

209 lines
8.4 KiB

  1. /*-------------------------------------------------------------------
  2. _printEx.h
  3. HACK!
  4. We need to add support for NT5 PrintDlgEx function but turns out
  5. that the corresponding headers are included for WinVER = 0x0500 ..
  6. but since WAB is being built with 0x0400, we can't include the
  7. headers directly - so we have included a copy of the PrintDlgEx
  8. At some point of time we should remove this copy and just use
  9. commdlg.h
  10. Created: 9/25/98 - Vikramm
  11. --------------------------------------------------------------------*/
  12. #ifdef STDMETHOD
  13. #if(WINVER < 0x0500)
  14. /*
  15. //-------------------------------------------------------------------------
  16. //
  17. // IPrintDialogCallback Interface
  18. //
  19. // IPrintDialogCallback::InitDone()
  20. // This function is called by PrintDlgEx when the system has finished
  21. // initializing the main page of the print dialog. This function
  22. // should return S_OK if it has processed the action or S_FALSE to let
  23. // PrintDlgEx perform the default action.
  24. //
  25. // IPrintDialogCallback::SelectionChange()
  26. // This function is called by PrintDlgEx when a selection change occurs
  27. // in the list view that displays the currently installed printers.
  28. // This function should return S_OK if it has processed the action or
  29. // S_FALSE to let PrintDlgEx perform the default action.
  30. //
  31. // IPrintDialogCallback::HandleMessage(hDlg, uMsg, wParam, lParam, pResult)
  32. // This function is called by PrintDlgEx when a message is sent to the
  33. // child window of the main page of the print dialog. This function
  34. // should return S_OK if it has processed the action or S_FALSE to let
  35. // PrintDlgEx perform the default action.
  36. //
  37. // IObjectWithSite::SetSite(punkSite)
  38. // IPrintDialogCallback usually paired with IObjectWithSite.
  39. // Provides the IUnknown pointer of the site to QI for the
  40. // IPrintDialogServices interface.
  41. //
  42. //-------------------------------------------------------------------------
  43. #undef INTERFACE
  44. #define INTERFACE IPrintDialogCallback
  45. DECLARE_INTERFACE_(IPrintDialogCallback, IUnknown)
  46. {
  47. // *** IUnknown methods ***
  48. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE;
  49. STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  50. STDMETHOD_(ULONG, Release) (THIS) PURE;
  51. // *** IPrintDialogCallback methods ***
  52. STDMETHOD(InitDone) (THIS) PURE;
  53. STDMETHOD(SelectionChange) (THIS) PURE;
  54. STDMETHOD(HandleMessage) (THIS_ HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pResult) PURE;
  55. };
  56. */
  57. //
  58. // Page Range structure for PrintDlgEx.
  59. //
  60. typedef struct tagPRINTPAGERANGE {
  61. DWORD nFromPage;
  62. DWORD nToPage;
  63. } PRINTPAGERANGE, *LPPRINTPAGERANGE;
  64. #define START_PAGE_GENERAL 0xffffffff
  65. //
  66. // PrintDlgEx structure.
  67. //
  68. typedef struct tagPDEXA {
  69. DWORD lStructSize; // size of structure in bytes
  70. HWND hwndOwner; // caller's window handle
  71. HGLOBAL hDevMode; // handle to DevMode
  72. HGLOBAL hDevNames; // handle to DevNames
  73. HDC hDC; // printer DC/IC or NULL
  74. DWORD Flags; // PD_ flags
  75. DWORD Flags2; // reserved
  76. DWORD ExclusionFlags; // items to exclude from driver pages
  77. DWORD nPageRanges; // number of page ranges
  78. DWORD nMaxPageRanges; // max number of page ranges
  79. LPPRINTPAGERANGE lpPageRanges; // array of page ranges
  80. DWORD nMinPage; // min page number
  81. DWORD nMaxPage; // max page number
  82. DWORD nCopies; // number of copies
  83. HINSTANCE hInstance; // instance handle
  84. LPCSTR lpPrintTemplateName; // template name for app specific area
  85. LPUNKNOWN lpCallback; // app callback interface
  86. DWORD nPropertyPages; // number of app property pages in lphPropertyPages
  87. HPROPSHEETPAGE *lphPropertyPages; // array of app property page handles
  88. DWORD nStartPage; // start page id
  89. DWORD dwResultAction; // result action if S_OK is returned
  90. } PRINTDLGEXA, *LPPRINTDLGEXA;
  91. //
  92. // PrintDlgEx structure.
  93. //
  94. typedef struct tagPDEXW {
  95. DWORD lStructSize; // size of structure in bytes
  96. HWND hwndOwner; // caller's window handle
  97. HGLOBAL hDevMode; // handle to DevMode
  98. HGLOBAL hDevNames; // handle to DevNames
  99. HDC hDC; // printer DC/IC or NULL
  100. DWORD Flags; // PD_ flags
  101. DWORD Flags2; // reserved
  102. DWORD ExclusionFlags; // items to exclude from driver pages
  103. DWORD nPageRanges; // number of page ranges
  104. DWORD nMaxPageRanges; // max number of page ranges
  105. LPPRINTPAGERANGE lpPageRanges; // array of page ranges
  106. DWORD nMinPage; // min page number
  107. DWORD nMaxPage; // max page number
  108. DWORD nCopies; // number of copies
  109. HINSTANCE hInstance; // instance handle
  110. LPCWSTR lpPrintTemplateName; // template name for app specific area
  111. LPUNKNOWN lpCallback; // app callback interface
  112. DWORD nPropertyPages; // number of app property pages in lphPropertyPages
  113. HPROPSHEETPAGE *lphPropertyPages; // array of app property page handles
  114. DWORD nStartPage; // start page id
  115. DWORD dwResultAction; // result action if S_OK is returned
  116. } PRINTDLGEXW, *LPPRINTDLGEXW;
  117. #ifdef UNICODE
  118. typedef PRINTDLGEXW PRINTDLGEX;
  119. typedef LPPRINTDLGEXW LPPRINTDLGEX;
  120. #else
  121. typedef PRINTDLGEXA PRINTDLGEX;
  122. typedef LPPRINTDLGEXA LPPRINTDLGEX;
  123. #endif // UNICODE
  124. HRESULT APIENTRY PrintDlgExA(LPPRINTDLGEXA);
  125. HRESULT APIENTRY PrintDlgExW(LPPRINTDLGEXW);
  126. #ifdef UNICODE
  127. #define PrintDlgEx PrintDlgExW
  128. #else
  129. #define PrintDlgEx PrintDlgExA
  130. #endif // !UNICODE
  131. /*--------------------------------------------------------------------------*/
  132. DEFINE_GUID(IID_IPrintDialogCallback, 0x5852a2c3, 0x6530, 0x11d1, 0xb6, 0xa3, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9);
  133. /*--------------------------------------------------------------------------*/
  134. #endif // (WINVER < 0x0500)
  135. #define WAB_PRINTDIALOGCALLBACK_METHODS(IPURE) \
  136. MAPIMETHOD_(HRESULT, InitDone) \
  137. (THIS) IPURE; \
  138. MAPIMETHOD_(HRESULT, SelectionChange) \
  139. (THIS) IPURE; \
  140. MAPIMETHOD_(HRESULT, HandleMessage) \
  141. (THIS_ HWND hDlg, UINT uMsg, WPARAM wParam, \
  142. LPARAM lParam, LRESULT *pResult) IPURE;
  143. #undef INTERFACE
  144. #define INTERFACE struct _WAB_PRINTDIALOGCALLBACK
  145. #undef METHOD_PREFIX
  146. #define METHOD_PREFIX WAB_PRINTDIALOGCALLBACK_
  147. #undef LPVTBL_ELEM
  148. #define LPVTBL_ELEM lpvtbl
  149. #undef MAPIMETHOD_
  150. #define MAPIMETHOD_(type, method) MAPIMETHOD_DECLARE(type, method, WAB_PRINTDIALOGCALLBACK_)
  151. MAPI_IUNKNOWN_METHODS(IMPL)
  152. WAB_PRINTDIALOGCALLBACK_METHODS(IMPL)
  153. #undef MAPIMETHOD_
  154. #define MAPIMETHOD_(type, method) MAPIMETHOD_TYPEDEF(type, method, WAB_PRINTDIALOGCALLBACK_)
  155. MAPI_IUNKNOWN_METHODS(IMPL)
  156. WAB_PRINTDIALOGCALLBACK_METHODS(IMPL)
  157. #undef MAPIMETHOD_
  158. #define MAPIMETHOD_(type, method) STDMETHOD_(type, method)
  159. DECLARE_MAPI_INTERFACE(WAB_PRINTDIALOGCALLBACK_)
  160. {
  161. BEGIN_INTERFACE
  162. MAPI_IUNKNOWN_METHODS(IMPL)
  163. WAB_PRINTDIALOGCALLBACK_METHODS(IMPL)
  164. };
  165. typedef struct _WAB_PRINTDIALOGCALLBACK
  166. {
  167. MAPIX_BASE_MEMBERS(WAB_PRINTDIALOGCALLBACK)
  168. LPIAB lpIAB;
  169. DWORD dwSelectedStyle;
  170. } WABPRINTDIALOGCALLBACK, * LPWABPRINTDIALOGCALLBACK;
  171. HRESULT HrCreatePrintCallbackObject(LPIAB lpIAB, LPWABPRINTDIALOGCALLBACK * lppWABPCO, DWORD dwSelectedStyle);
  172. #endif