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.

306 lines
7.8 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. faxui.h
  5. Abstract:
  6. Fax driver user interface header file
  7. Environment:
  8. Fax driver user interface
  9. Revision History:
  10. 01/09/96 -davidx-
  11. Created it.
  12. dd-mm-yy -author-
  13. description
  14. --*/
  15. #ifndef _FAXUI_H_
  16. #define _FAXUI_H_
  17. #include <windows.h>
  18. #include <winfax.h>
  19. #include "faxlib.h"
  20. #include <winddiui.h>
  21. #include <commctrl.h>
  22. #include <windowsx.h>
  23. #include <prsht.h>
  24. #ifdef FAX_SCAN_ENABLED
  25. #include <twain.h>
  26. #endif
  27. #include "registry.h"
  28. #include "timectrl.h"
  29. #include "coverpg.h"
  30. #include "resource.h"
  31. #include "faxcfgrs.h"
  32. //
  33. // Data structure maintained by the fax driver user interface
  34. //
  35. typedef struct {
  36. PVOID startSign;
  37. HANDLE hPrinter;
  38. HANDLE hheap;
  39. DRVDEVMODE devmode;
  40. PFNCOMPROPSHEET pfnComPropSheet;
  41. HANDLE hComPropSheet;
  42. HANDLE hFaxOptsPage;
  43. BOOL hasPermission;
  44. BOOL configDefault;
  45. LPTSTR pHelpFile;
  46. INT cForms;
  47. LPTSTR pFormNames;
  48. PWORD pPapers;
  49. PVOID endSign;
  50. } UIDATA, *PUIDATA;
  51. //
  52. // Check if a UIDATA structure is valid
  53. //
  54. #define ValidUiData(p) ((p) && (p) == (p)->startSign && (p) == (p)->endSign)
  55. //
  56. // Combine DEVMODE information:
  57. // start with the driver default
  58. // then merge with the system default
  59. // then merge with the user default
  60. // finally merge with the input devmode
  61. //
  62. VOID
  63. GetCombinedDevmode(
  64. PDRVDEVMODE pdmOut,
  65. PDEVMODE pdmIn,
  66. HANDLE hPrinter,
  67. PPRINTER_INFO_2 pPrinterInfo2,
  68. BOOL publicOnly
  69. );
  70. //
  71. // Fill in the data structure used by the fax driver user interface
  72. //
  73. PUIDATA
  74. FillUiData(
  75. HANDLE hPrinter,
  76. PDEVMODE pdmInput
  77. );
  78. //
  79. // Calling common UI DLL entry point dynamically
  80. //
  81. LONG
  82. CallCompstui(
  83. HWND hwndOwner,
  84. PFNPROPSHEETUI pfnPropSheetUI,
  85. LPARAM lParam,
  86. PDWORD pResult
  87. );
  88. //
  89. // Retrieves a list of supported paper sizes
  90. //
  91. DWORD
  92. EnumPaperSizes(
  93. PVOID pOutput,
  94. FORM_INFO_1 *pFormsDB,
  95. DWORD cForms,
  96. INT wCapability
  97. );
  98. #define CCHBINNAME 24 // max length for bin names
  99. #define CCHPAPERNAME 64 // max length for form names
  100. //
  101. // Display an error message dialog
  102. //
  103. INT
  104. DisplayMessageDialog(
  105. HWND hwndParent,
  106. UINT type,
  107. INT formatStrId,
  108. INT titleStrId,
  109. ...
  110. );
  111. #define MAX_TITLE_LEN 128
  112. #define MAX_FORMAT_LEN 128
  113. #define MAX_MESSAGE_LEN 512
  114. //
  115. // Information about each recipient
  116. //
  117. typedef struct {
  118. PVOID pNext; // Points to next recipient
  119. LPTSTR pName; // Recipient name
  120. LPTSTR pAddress; // Recipient address
  121. } RECIPIENT, *PRECIPIENT;
  122. //
  123. // Data structure used by the user mode DLL to associate private
  124. // information with a printer device context (PDEV to be exactly)
  125. //
  126. typedef struct {
  127. DRVDEVMODE devmode; // The first field must be a current version devmode
  128. PVOID pNext; // Points to the next item in the linked list
  129. HANDLE hPrinter; // Handle to the printer object
  130. HDC hdc; // Handle to the device context
  131. LPTSTR pPrinterName; // name of the printer
  132. BOOL isLocalPrinter; // whether the printer is local
  133. INT pageCount; // Number of pages in the document
  134. BOOL finishPressed; // User pressed Finish in fax wizard pages
  135. DWORD jobId; // Current job ID
  136. PRECIPIENT pRecipients; // List of recipients
  137. LPTSTR pSubject; // Subject string
  138. LPTSTR pNoteMessage; // Note message string
  139. TCHAR coverPage[MAX_PATH]; // Cover page filename
  140. BOOL noteOnCover; // Whether to send note message on the cover page
  141. INT jobType; // Job type
  142. PVOID pCPInfo; // For managing cover pages
  143. BOOL directPrinting; // Direct printing and skip the fax wizard
  144. LPVOID lpWabInit; // pointer to wab object
  145. DWORD noteSubjectFlag; // Whether note/subject fields are present on cover page
  146. SHORT cpPaperSize; // Cover page paper size
  147. SHORT cpOrientation; // Cover page orientation
  148. PVOID pEnvVar; // fax attachment variable
  149. LPTSTR pPrintFile; // print to file file name
  150. BOOL ServerCPOnly; //
  151. HANDLE hFaxSvcEvent; // signals fax service query complete
  152. HANDLE hTapiEvent; // signals tapi enumeration complete
  153. HANDLE hMutex; //
  154. HFONT hLargeFont; // large bold font for wizard 97
  155. #ifdef FAX_SCAN_ENABLED
  156. HWND hDlgScan; // scanning wizard page
  157. HMODULE hTwain; // module handle for twain dll
  158. DSMENTRYPROC pDsmEntry; // pointer to the twain data source manager proc
  159. TW_IDENTITY AppId; // application id/handle for twain
  160. TW_IDENTITY DataSource; // application id/handle for twain
  161. HWND hWndTwain; // window handle for twain
  162. HANDLE hEvent; //
  163. HANDLE hEventQuit; //
  164. HANDLE hEventXfer; //
  165. HANDLE hThread; //
  166. BOOL TwainCancelled; // TRUE if twain UI was cancelled
  167. HANDLE hTwainEvent; // signals twain detection complete
  168. BOOL TwainAvail; //
  169. BOOL TwainActive; //
  170. DWORD BufferSize; //
  171. LPBYTE ScanBuffer; //
  172. DWORD State; //
  173. float dxResDefault; //
  174. float dyResDefault; //
  175. TW_IMAGELAYOUT twImageLayoutDefault; //
  176. WCHAR FileName[MAX_PATH]; //
  177. DWORD PageCount; //
  178. #endif
  179. PVOID signature; // Signature
  180. } USERMEM, *PUSERMEM;
  181. //
  182. // Validate a user mode memory structure
  183. //
  184. #define ValidPDEVUserMem(p) \
  185. ((p) && (p) == (p)->signature && (p) == (p)->devmode.dmPrivate.pUserMem)
  186. //
  187. // Mark the user mode memory structure
  188. //
  189. #define MarkPDEVUserMem(p) \
  190. { (p)->signature = (p)->devmode.dmPrivate.pUserMem = (p); }
  191. //
  192. // Different types of print job
  193. //
  194. #define JOBTYPE_DIRECT 0
  195. #define JOBTYPE_NORMAL 1
  196. //
  197. // Free up the list of recipients associated with each fax job
  198. //
  199. VOID
  200. FreeRecipientList(
  201. PUSERMEM pUserMem
  202. );
  203. #define FreeRecipient(pRecipient) { \
  204. MemFree(pRecipient->pName); \
  205. MemFree(pRecipient->pAddress); \
  206. MemFree(pRecipient); \
  207. }
  208. //
  209. // Free up the user mode memory associated with each PDEV
  210. //
  211. VOID
  212. FreePDEVUserMem(
  213. PUSERMEM pUserMem
  214. );
  215. //
  216. // Global variable declarations
  217. //
  218. extern CRITICAL_SECTION faxuiSemaphore;
  219. extern HANDLE ghInstance;
  220. extern BOOL oleInitialized;
  221. extern PUSERMEM gUserMemList;
  222. #define EnterDrvSem() EnterCriticalSection(&faxuiSemaphore)
  223. #define LeaveDrvSem() LeaveCriticalSection(&faxuiSemaphore)
  224. INT_PTR
  225. UserInfoDlgProc(
  226. HWND hDlg,
  227. UINT message,
  228. WPARAM wParam,
  229. LPARAM lParam
  230. );
  231. DWORD
  232. AsyncWizardThread(
  233. PBYTE param
  234. );
  235. BOOL
  236. InitializeTwain(
  237. PUSERMEM pUserMem
  238. );
  239. #define MyHideWindow(_hwnd) SetWindowLong((_hwnd),GWL_STYLE,GetWindowLong((_hwnd),GWL_STYLE)&~WS_VISIBLE)
  240. #endif // !_FAXUI_H_