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.

292 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. util.h
  5. Abstract:
  6. Misc. utility functions used by the fax configuration applet
  7. Environment:
  8. Fax configuration applet
  9. Revision History:
  10. 03/13/96 -davidx-
  11. Created it.
  12. dd-mm-yy -author-
  13. description
  14. --*/
  15. #ifndef _UTIL_H_
  16. #define _UTIL_H_
  17. //
  18. // Enable or disable the Apply button in the property sheet
  19. // depending on if any of the dialog contents was changed
  20. //
  21. VOID
  22. SetChangedFlag(
  23. HWND hDlg,
  24. INT pageIndex,
  25. BOOL changed
  26. );
  27. //
  28. // Windows NT fax driver name - currently this name cannot be
  29. // localized so it shouldn't be put into the string resource.
  30. //
  31. #define FAX_DRIVER_NAME TEXT("Windows NT Fax Driver")
  32. //
  33. // Get a list of fax devices available on the system and
  34. // retrieve fax configuration information from the service
  35. //
  36. BOOL
  37. GetFaxDeviceAndConfigInfo(
  38. VOID
  39. );
  40. //
  41. // Dispose of fax device and configuration information
  42. //
  43. VOID
  44. FreeFaxDeviceAndConfigInfo(
  45. VOID
  46. );
  47. //
  48. // Save fax device and configuration information
  49. //
  50. BOOL
  51. SaveFaxDeviceAndConfigInfo(
  52. HWND hDlg,
  53. INT pageIndex
  54. );
  55. //
  56. // Make a duplicate of the specified character string
  57. //
  58. LPTSTR
  59. DuplicateString(
  60. LPCTSTR pSrcStr
  61. );
  62. //
  63. // Enable or disable a set of controls in a dialog
  64. //
  65. VOID
  66. EnableControls(
  67. HWND hDlg,
  68. INT *pCtrlIds,
  69. BOOL enabled
  70. );
  71. //
  72. // Show or hide a set of controls in a dialog
  73. //
  74. VOID
  75. ShowControls(
  76. HWND hDlg,
  77. INT *pCtrlIds,
  78. BOOL visible
  79. );
  80. //
  81. // Limit the maximum length for a number of text fields
  82. //
  83. VOID
  84. LimitTextFields(
  85. HWND hDlg,
  86. INT *pLimitInfo
  87. );
  88. //
  89. // Display an error message dialog
  90. //
  91. INT
  92. DisplayMessageDialog(
  93. HWND hwndParent,
  94. UINT type,
  95. INT formatStrId,
  96. INT titleStrId,
  97. ...
  98. );
  99. #define MAX_TITLE_LEN 128
  100. #define MAX_MESSAGE_LEN 512
  101. //
  102. // A flag to indicate whether we're inside SetDlgItemText call.
  103. // This is a kluge but we have no other way of telling whether
  104. // an EN_CHANGE message is caused by user action or by us calling
  105. // SetDlgItemText.
  106. //
  107. extern BOOL insideSetDlgItemText;
  108. #define MySetDlgItemText(hDlg, itemId, msgText) { \
  109. insideSetDlgItemText = TRUE; \
  110. SetDlgItemText(hDlg, itemId, msgText); \
  111. insideSetDlgItemText = FALSE; \
  112. }
  113. //
  114. // Browse for a directory
  115. //
  116. BOOL
  117. DoBrowseForDirectory(
  118. HWND hDlg,
  119. INT textFieldId,
  120. INT titleStrId
  121. );
  122. PVOID
  123. MyEnumPrinters(
  124. LPTSTR pServerName,
  125. DWORD level,
  126. PDWORD pcPrinters,
  127. DWORD dwFlags
  128. );
  129. //
  130. // Wrapper function for fax service API FaxEnumPorts
  131. //
  132. PVOID
  133. FaxSvcEnumPorts(
  134. HANDLE hFaxSvc,
  135. PDWORD pcPorts
  136. );
  137. //
  138. // Wrapper function for fax service API FaxGetDeviceStatus
  139. //
  140. PFAX_DEVICE_STATUS
  141. FaxSvcGetDeviceStatus(
  142. HANDLE hFaxSvc,
  143. DWORD DeviceId
  144. );
  145. //
  146. // Destination port names for a printer are separated by comma
  147. //
  148. #define PORTNAME_SEPARATOR TEXT(',')
  149. //
  150. // Determine whether a list view item is checked or not
  151. //
  152. #define UNCHECKED_STATE INDEXTOSTATEIMAGEMASK(1)
  153. #define CHECKED_STATE INDEXTOSTATEIMAGEMASK(2)
  154. #define IsListViewItemChecked(hwndLV, index) \
  155. (ListView_GetItemState(hwndLV, index, LVIS_STATEIMAGEMASK) == CHECKED_STATE)
  156. #define CheckListViewItem(hwndLV, index) \
  157. ListView_SetItemState(hwndLV, index, CHECKED_STATE, LVIS_STATEIMAGEMASK)
  158. #define UncheckListViewItem(hwndLV, index) \
  159. ListView_SetItemState(hwndLV, index, UNCHECKED_STATE, LVIS_STATEIMAGEMASK)
  160. //
  161. // Toggle the checkbox associated with the specified list view item
  162. //
  163. VOID
  164. ToggleListViewCheckbox(
  165. HWND hwndLV,
  166. INT index
  167. );
  168. //
  169. // Initialize the fax device list view
  170. //
  171. typedef struct {
  172. INT columnId; // column identifier
  173. INT columnWidth; // relative column width
  174. } COLUMNINFO, *PCOLUMNINFO;
  175. VOID
  176. InitFaxDeviceListView(
  177. HWND hwndLV,
  178. DWORD flags,
  179. PCOLUMNINFO pColumnInfo
  180. );
  181. #define LV_HASCHECKBOX 0x0001
  182. #define COLUMN_NONE 0
  183. #define COLUMN_DEVICE_NAME 1
  184. #define COLUMN_CSID 2
  185. #define COLUMN_TSID 3
  186. #define COLUMN_STATUS 4
  187. #define MAX_COLUMNS 5
  188. //
  189. // Refresh columns in the fax device list view
  190. //
  191. VOID
  192. UpdateFaxDeviceListViewColumns(
  193. HWND hwndLV,
  194. PCOLUMNINFO pColumnInfo,
  195. INT startColumn
  196. );
  197. //
  198. // Handle context-sensitive help in property sheet pages
  199. //
  200. BOOL
  201. HandleHelpPopup(
  202. HWND hDlg,
  203. UINT message,
  204. UINT wParam,
  205. LPARAM lParam,
  206. INT pageIndex
  207. );
  208. //
  209. // Assemble fax device status string
  210. //
  211. LPTSTR
  212. MakeDeviceStatusString(
  213. DWORD state
  214. );
  215. //
  216. // Get MAPI profiles from server
  217. //
  218. BOOL
  219. GetMapiProfiles(
  220. VOID
  221. );
  222. #endif // !_UTIL_H_