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.

315 lines
11 KiB

  1. /*
  2. - uiutil.h
  3. - common UI stuff
  4. - will be included by modules that require these UI services
  5. - services are in: ui\faxcfg\
  6. - uiutil.c
  7. - tapi.c
  8. - comdlg.c
  9. - registry.c
  10. - DLL for these services: awfxcg32.dll
  11. *
  12. *
  13. */
  14. #include "phonenum.h"
  15. /*
  16. * complement the macros in winuser.h to extract notification codes
  17. */
  18. #ifdef WIN16
  19. #define GET_WM_COMMAND_NOTIFICATION_CODE(wp, lp) HIWORD(lp)
  20. #define GET_WM_COMMAND_CONTROL_ID(wp, lp) (wp)
  21. #define GET_WM_COMMAND_CONTROL_HANDLE(wp, lp) (HWND)(LOWORD)(lp)
  22. #else
  23. #define GET_WM_COMMAND_NOTIFICATION_CODE(wp, lp) HIWORD(wp)
  24. #define GET_WM_COMMAND_CONTROL_ID(wp, lp) LOWORD(wp)
  25. #define GET_WM_COMMAND_CONTROL_HANDLE(wp, lp) (HWND)(lp)
  26. #endif
  27. /***************************
  28. ******** Constants ********
  29. ***************************/
  30. #define DDL_HIDEEXT 0x0001
  31. #define DDL_DONTRESET 0x0002
  32. #define DDL_FOLLOWLINKS 0x0004
  33. #define DDL_MAPIDIALOG 0x0008
  34. // no dirs or temp files allowed!
  35. #define FILE_ATTRIB_ALL ( FILE_ATTRIBUTE_ARCHIVE |\
  36. FILE_ATTRIBUTE_HIDDEN |\
  37. FILE_ATTRIBUTE_READONLY |\
  38. FILE_ATTRIBUTE_SYSTEM |\
  39. FILE_ATTRIBUTE_NORMAL )
  40. /***************************
  41. ***** Date/time stuff *****
  42. ***************************/
  43. // Time Control constants
  44. #define DATETIME_COMPONENTS 14
  45. #define HOUR 0 /* index into wDateTime */
  46. #define MINUTE 1
  47. #define SECOND 2
  48. #define MONTH 3
  49. #define DAY 4
  50. #define YEAR 5
  51. #define WEEKDAY 6
  52. #define AMPM 10
  53. #define SEPARATOR 11
  54. #define BORDER 12
  55. #define ARROW 13
  56. /*****************************************************************************
  57. Dos Date format is:
  58. bits 0-8 contian the day number within the year.
  59. bits 9-15 contain the years since 1990. (ie, 1990 = 0)
  60. Thus, the earliest date is 1/1/1990, which is reprsented by
  61. the DOSDATE==1.
  62. *****************************************************************************/
  63. typedef WORD DOSDATE;
  64. // wFormat flags for flags for GetTimeDateStr() wFormat should == FMT_STRxxx
  65. // flags optionally ored with FMT_NOSECONDS
  66. #define FMT_DATE 0x0001
  67. #define FMT_TIME 0x0002
  68. #define FMT_STRMASK 0x00F0
  69. #define FMT_STRDATE 0x0011 // includes FMT_DATE
  70. #define FMT_STRTIME 0x0022 // includes FMT_TIME
  71. #define FMT_STRTIMEDATE 0x0033 // includes FMT_DATE and FMT_TIME
  72. #define FMT_STRDATETIME 0x0043 // includes FMT_DATE and FMT_TIME
  73. #define FMT_NOSECONDS 0x0100
  74. /***************************
  75. *** International stuff ***
  76. ***************************/
  77. /* Suffix length + NULL terminator */
  78. #define TIMESUF_LEN 9
  79. typedef struct /* International section description */
  80. {
  81. char sCountry[24]; /* Country name */
  82. int iCountry; /* Country code (phone ID) */
  83. int iDate; /* Date mode (0:MDY, 1:DMY, 2:YMD) */
  84. int iTime; /* Time mode (0: 12 hour clock, 1: 24 ) */
  85. int iTLZero; /* Leading zeros for hour (0: no, 1: yes) */
  86. int iCurFmt; /* Currency mode(0: prefix, no separation
  87. 1: suffix, no separation
  88. 2: prefix, 1 char separation
  89. 3: suffix, 1 char separation) */
  90. int iCurDec; /* Currency Decimal Place */
  91. int iNegCur; /* Negative currency pattern
  92. ($1.23), -$1.23, $-1.23, $1.23-, etc. */
  93. int iLzero; /* Leading zeros of decimal (0: no, 1: yes) */
  94. int iDigits; /* Significant decimal digits */
  95. int iMeasure; /* Metric 0; British 1 */
  96. char s1159[TIMESUF_LEN]; /* Trailing string from 0:00 to 11:59 */
  97. char s2359[TIMESUF_LEN]; /* Trailing string from 12:00 to 23:59 */
  98. char s1159old[TIMESUF_LEN]; /* Old trailing string from 0:00 to 11:59 */
  99. char s2359old[TIMESUF_LEN]; /* Old trailing string from 12:00 to 23:59 */
  100. char sCurrency[6]; /* Currency symbol string */
  101. char sThousand[4]; /* Thousands separator string */
  102. char sDecimal[4]; /* Decimal separator string */
  103. char sDateSep[4]; /* Date separator string */
  104. char sTime[4]; /* Time separator string */
  105. char sList[4]; /* List separator string */
  106. char sLongDate[80];
  107. char sShortDate[80];
  108. char sLanguage[4];
  109. short iDayLzero; /* Day Leading zero for Short Time format */
  110. short iMonLzero; /* Month Leading zero for Short Time format */
  111. short iCentury; /* Display full century in Short Time format */
  112. short iLDate; /* Long Date mode (0:MDY, 1:DMY, 2:YMD) */
  113. } INTLSTRUCT;
  114. typedef INTLSTRUCT FAR *LPINTL;
  115. typedef INTLSTRUCT NEAR *PINTL;
  116. /******************************************
  117. *** Telephone number encoding/decoding ***
  118. ******************************************/
  119. #define tapiVersionCur 0x00010004
  120. // Sender fax number fields (number, country code, area code) flags
  121. #define TEL_AREACODEDISABLE 0x00000002
  122. #define TEL_NOAREACODEDISABLE 0x00000000
  123. #define TEL_MUSTFAXNUMBER 0x00000004
  124. #define TEL_NOMUSTFAXNUMBER 0x00000000
  125. // per-country area codes support
  126. #define MANDATORY_AREA_CODES 2
  127. #define OPTIONAL_AREA_CODES 1
  128. #define NO_AREA_CODES FALSE
  129. /******************************************
  130. *********** Modem ******
  131. ******************************************/
  132. #define DEVICE_NAME_SIZE MAX_PATH/4 // Maximum size for the name of a fax device
  133. typedef struct tagPARSEDMODEM
  134. {
  135. WORD iModemType; // type of the modem
  136. DWORD dwModemID; // line ID (or com port) for a local modem
  137. DWORD dwTAPIPermanentID; // TAPI permanent line ID
  138. TCHAR szDisplayName[DEVICE_NAME_SIZE]; // modem name for netfax devices
  139. TCHAR szDeviceTypeName[DEVICE_NAME_SIZE]; // the name for this device type. this
  140. // connects into the device type structure
  141. } PARSEDMODEM, *LPPARSEDMODEM;
  142. typedef struct tagMODEMPROPS
  143. {
  144. ULONG iAnswerMode;
  145. ULONG iNumRings;
  146. ULONG iBlindDial;
  147. ULONG iCommaDelay;
  148. ULONG iDialToneWait;
  149. ULONG iHangupDelay;
  150. ULONG iSpeakerMode;
  151. ULONG iSpeakerVolume;
  152. } MODEMPROPS, *LPMODEMPROPS;
  153. /***********************************************************
  154. *** Prototypes for functions exported from awfxcg32.dll ***
  155. ***********************************************************/
  156. #ifdef __cplusplus
  157. extern "C" {
  158. #endif
  159. /*
  160. * General
  161. */
  162. void StripExtension(LPTSTR lpFileName, LPTSTR lpExt);
  163. void StripAnyExtension(LPTSTR lpFileName);
  164. void ReplaceExtension(LPTSTR lpszPath, LPTSTR lpszNewExt);
  165. void ReplaceSpecificExtension(LPTSTR lpszPath, LPTSTR lpszOldExt, LPTSTR lpszNewExt);
  166. BOOL TruncateString(LPTSTR lpszString, LONG nBytes);
  167. LPTSTR FindEndOfString(LPTSTR stringPtr);
  168. LPTSTR FindLastCharInString(LPTSTR stringPtr);
  169. BOOL ReplaceChars(LPTSTR lpszString, TCHAR cCharIn, TCHAR cCharOut);
  170. LPTSTR ReplaceLastOccurence(LPTSTR lpszString, TCHAR cCharIn, TCHAR cCharOut);
  171. BOOL IsNumberString(LPSTR lpszString, ULONG n);
  172. BOOL IsTelNumberString(LPSTR lpszString, ULONG n);
  173. BOOL MySplitPath(LPTSTR lpszFullPath, LPTSTR lpszPath, LPTSTR lpszFileName, LPTSTR lpszExt);
  174. BOOL IsFullPath(LPSTR lpszString);
  175. int MakeMessageBox(HINSTANCE, HWND, DWORD, UINT, UINT, ...);
  176. UINT GetWindowsDirectoryWithSlash(LPSTR lpBuffer, UINT uSize);
  177. DOSDATE EncodeDosDate(WORD wMonth, WORD wDay, WORD wYear);
  178. DOSDATE EncodeLocalDosDate(BOOL fToday);
  179. void DecodeDosDate(DOSDATE dosdate, WORD *pwMonth, WORD *pwDay, WORD *pwYear);
  180. int GetTimeDateStr(WORD wHour, WORD wMinute, WORD wSecond, WORD wMilliseconds,
  181. DOSDATE wDosDate, LPTSTR pBuf, int iSizeBuf, WORD wFormat);
  182. int CountFiles(LPTSTR lpOrigPathSpec, ULONG ulFlags);
  183. /*
  184. * localization-related
  185. */
  186. BOOL IsDBCSTrailByte(LPTSTR stringPtr, LPTSTR bytePtr);
  187. /*
  188. * common dialogs
  189. */
  190. int WINAPI DDirList(HWND hDlg, LPTSTR lpPathSpec, int nIDListBox, UINT uFileType, UINT uFlags);
  191. BOOL WINAPI DDirSelect(HWND hDlg, LPTSTR lpString, int nCount, int nIDListBox, LPTSTR lpExt);
  192. BOOL GetSelectedCoverPage(HWND hDlg, LPTSTR lpszString, int nCount, int nIDListBox, LPTSTR lpszExt);
  193. BOOL GetCoverPageDisplayName(HWND hDlg, int nCPListCID, LPTSTR lpszFile, ULONG ulFlags,
  194. LPTSTR lpszDisplayName);
  195. /*
  196. * time handling
  197. */
  198. void InitTimeInfo();
  199. void InitTimeControl(HWND, const int[], short int []);
  200. BOOL HandleTimeControl(HWND, UINT, short, short int[], const int[], WPARAM, LPARAM, ULONG);
  201. void EnableTimeControls(HWND hDlg, const int wCtrlIDs[], BOOL flag);
  202. /*
  203. * telephone number-related
  204. */
  205. // BOOL EncodeFaxAddress(LPTSTR lpszFaxAddr, LPPARSEDTELNUMBER lpParsedFaxAddr);
  206. // BOOL DecodeFaxAddress(LPTSTR lpszFaxAddr, LPPARSEDTELNUMBER lpParsedFaxAddr);
  207. BOOL GetCountry(DWORD dwReqCountryID, LPLINECOUNTRYLIST *lppLineCountryList);
  208. BOOL GetCountryCode(DWORD dwReqCountryID, DWORD *lpdwCountryCode);
  209. BOOL GetCountryID(DWORD dwCountryCode, DWORD *lpdwCountryID);
  210. BOOL InitCountryCodesLB(HWND hLBControl, HWND hAreaCodeControl,DWORD dwCurCountryID,
  211. HINSTANCE hInst, ULONG ulFlags);
  212. void HandleCountryCodesLB(HWND hCBControl, HWND hAreaCodeControl, WPARAM wParam, LPARAM lParam);
  213. /*
  214. * modem-related
  215. */
  216. BOOL EncodeModemName(LPTSTR lpszModemName, LPPARSEDMODEM lpParsedModem);
  217. BOOL DecodeModemName(LPTSTR lpszModemName, LPPARSEDMODEM lpParsedModem);
  218. BOOL GetModemProperties(HWND hDlg, LPTSTR lpszModemName, LPMODEMPROPS lpsModemProps);
  219. BOOL SetModemProperties(HWND hDlg, LPTSTR lpszModemName, LPMODEMPROPS lpsModemProps);
  220. /*
  221. * TAPI-related
  222. */
  223. DWORD TAPIBasicInit(HINSTANCE hInst, HWND hWnd, LPSTR lpszAppName);
  224. DWORD InitTAPI(HINSTANCE hInst, HWND hWnd, LPSTR lpszAppName);
  225. BOOL DeinitTAPI();
  226. WORD TAPIGetLines(WORD index);
  227. LONG CallConfigDlg(HWND, LPCSTR);
  228. LONG SetCurrentLocation(DWORD);
  229. LONG GetCurrentLocationID( DWORD *lpdwLocation);
  230. LPTSTR GetCurrentLocationName(void);
  231. DWORD HowManyLocations(DWORD *lpdwNumLocations);
  232. DWORD InitLocationParams(HWND hWnd);
  233. LPTSTR GetCurrentCallingCardName(void);
  234. BOOL SetCurrentCallingCardName(LPTSTR szCard);
  235. BOOL GetAreaCode(DWORD dwCountryID, LPTSTR lpszAreaCode);
  236. LPTSTR GetCurrentLocationAreaCode(void);
  237. DWORD GetCurrentLocationCountryID(void);
  238. DWORD GetCurrentLocationCountryCode(void);
  239. DWORD GetTranslateCaps(LPLINETRANSLATECAPS *lpTransCaps);
  240. DWORD GetTranslateOutput(LPCSTR lpszAddress, LPLINETRANSLATEOUTPUT *lpTransOutput);
  241. BOOL ChangeTollList(LPCSTR lpszAddress, DWORD dwWhat);
  242. BOOL SetTollList(LPCSTR lpszAddress, DWORD dwWhat);
  243. BOOL AreTollPrefixesSupported(void);
  244. BOOL IsInTollList(LPCSTR lpszAddress);
  245. ULONG GetTollList(HWND hWnd, DWORD dwLocID, LPTSTR lpszBuf, DWORD * lpdwBufSize);
  246. ULONG EditTollListDialog(HWND hWnd);
  247. /*
  248. * Registry access functions prototypes
  249. */
  250. UINT GetInitializerInt(
  251. HKEY hPDKey,
  252. LPCTSTR lpszSection,
  253. LPCTSTR lpszKey,
  254. INT dwDefault,
  255. LPCTSTR lpszFile);
  256. DWORD GetInitializerString(
  257. HKEY hPDKey,
  258. LPCTSTR lpszSection,
  259. LPCTSTR lpszKey,
  260. LPCTSTR lpszDefault,
  261. LPTSTR lpszReturnBuffer,
  262. DWORD cchReturnBuffer,
  263. LPCTSTR lpszFile);
  264. BOOL WriteInitializerString(
  265. HKEY hPDKey,
  266. LPCTSTR lpszSection,
  267. LPCTSTR lpszKey,
  268. LPCTSTR lpszString,
  269. LPCTSTR lpszFile);
  270. BOOL WriteInitializerInt(
  271. HKEY hPDKey,
  272. LPCTSTR lpszSection,
  273. LPCTSTR lpszKey,
  274. DWORD i,
  275. LPCTSTR lpszFile);
  276. #ifdef __cplusplus
  277. }
  278. #endif