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.

236 lines
7.3 KiB

  1. /** FILE: cplib.h ********** Module Header ********************************
  2. *
  3. * Control panel utility library routines for use by control panel applets.
  4. * Common definitions, resource ids, typedefs, external declarations and
  5. * library routine function prototypes.
  6. *
  7. * History:
  8. * 15:30 on Thur 25 Apr 1991 -by- Steve Cathcart [stevecat]
  9. * Took base code from Win 3.1 source
  10. * 10:30 on Tues 04 Feb 1992 -by- Steve Cathcart [stevecat]
  11. * Updated code to latest Win 3.1 sources
  12. *
  13. * Copyright (C) 1990-1992 Microsoft Corporation
  14. *
  15. *************************************************************************/
  16. //==========================================================================
  17. // Typedefs and Definitions
  18. //==========================================================================
  19. // NOTE: The following lines are used by applets to define items in their
  20. // resource files. These are necessary to be compatible with some of
  21. // library routines.
  22. //
  23. // Resource String ids for Applets
  24. #define INITS 16
  25. #define CLASS 36
  26. #define COPY (CLASS + 4)
  27. #define UTILS 64
  28. #define INSTALLIT 196
  29. #define FOO -1 // for useless control ids
  30. #define IDD_HELP 200 // Help control id
  31. #define CP_ACCEL 100 // Keyboard Accelerator table
  32. // End resource file definitions
  33. #define PATHMAX 133 // path length max
  34. #define MYNUL (LPSTR) szNull
  35. #define COLOR_SAVE 711
  36. #define NOSELECT -1 // indices for int Selected
  37. #define HOUR 0 // index into rDateTime, wDateTime, wRange
  38. #define MINUTE 1
  39. #define SECOND 2
  40. #define MONTH 3
  41. #define DAY 4
  42. #define YEAR 5
  43. #define WEEKDAY 6
  44. #if 0
  45. #define UPTIME 6
  46. #define DOWNTIME 7
  47. #define UPDATE 8
  48. #define DOWNDATE 9
  49. #endif
  50. typedef BOOL (APIENTRY *BWNDPROC)(HWND, UINT, DWORD, LONG);
  51. #ifndef NOARROWS
  52. typedef struct
  53. {
  54. short lineup; /* lineup/down, pageup/down are relative */
  55. short linedown; /* changes. top/bottom and the thumb */
  56. short pageup; /* elements are absolute locations, with */
  57. short pagedown; /* top & bottom used as limits. */
  58. short top;
  59. short bottom;
  60. short thumbpos;
  61. short thumbtrack;
  62. BYTE flags; /* flags set on return */
  63. } ARROWVSCROLL;
  64. typedef ARROWVSCROLL NEAR *NPARROWVSCROLL;
  65. typedef ARROWVSCROLL FAR *LPARROWVSCROLL;
  66. #define UNKNOWNCOMMAND 1
  67. #define OVERFLOW 2
  68. #define UNDERFLOW 4
  69. #endif
  70. #define COPY_CANCEL 0
  71. #define COPY_SELF -1
  72. #define COPY_NOCREATE -2
  73. #define COPY_DRIVEOPEN -3
  74. #define COPY_NODISKSPACE -4
  75. #define COPY_NOMEMORY -5
  76. // AddStringToObject defines
  77. #define ASO_GLOBAL 0x0001
  78. #define ASO_FIXED 0x0002
  79. #define ASO_EXACT 0x0004
  80. #define ASO_COMPACT 0x0008
  81. /* Help defines */
  82. #define IDH_HELPFIRST 5000
  83. #define IDH_DLGFIRST (IDH_HELPFIRST + 3000)
  84. #define IDH_DLG_CONFLICT (IDH_DLGFIRST + DLG_CONFLICT)
  85. #define IDH_DLG_ADDFILE (IDH_DLGFIRST + DLG_ADDFILE)
  86. #define MENU_INDHELP 40
  87. //==========================================================================
  88. // Macros
  89. //==========================================================================
  90. #define GSM(SM) GetSystemMetrics(SM)
  91. #define GDC(dc, index) GetDeviceCaps(dc, index)
  92. #define LPMIS LPMEASUREITEMSTRUCT
  93. #define LPDIS LPDRAWITEMSTRUCT
  94. #define LPCIS LPCOMPAREITEMSTRUCT
  95. #define LONG2POINT(l, pt) (pt.y = (int) HIWORD(l), pt.x = (int) LOWORD(l))
  96. //==========================================================================
  97. // External Declarations
  98. //==========================================================================
  99. /* exported from applets */
  100. extern HANDLE hModule;
  101. /* exported from cplib */
  102. /* initapp.c */
  103. extern char szOnString[]; // separator printer/port in listboxes
  104. extern char szSeparator[]; // separator filename printer desc
  105. extern char szDefNullPort[]; // default null port name
  106. extern char szCtlPanel[];
  107. extern char szErrMem[];
  108. extern char szBasePath[]; /* Path to WIN.INI directory */
  109. extern char szWinIni[]; /* Path to WIN.INI */
  110. extern char szWinCom[]; /* Path to WIN.COM directory */
  111. extern char szSystemIniPath[]; /* Path to SYSTEM.INI */
  112. extern char szCtlIni[]; /* Path to CONTROL.INI */
  113. extern char szControlHlp[];
  114. extern char szSetupInfPath[];
  115. extern char szSetupDir[];
  116. extern char szSharedDir[];
  117. extern char pszSysDir[];
  118. extern char pszWinDir[];
  119. extern char pszClose[];
  120. extern char pszContinue[];
  121. extern char szSYSTEMINI[];
  122. extern char szSETUPINF[];
  123. extern char szCONTROLINF[];
  124. extern char BackSlash[];
  125. extern char szFOT[];
  126. extern char szDot[];
  127. extern unsigned wMerge; /* MERGE SPEC FOR STRINGS */
  128. /* utiltext.c */
  129. extern char szGenErr[];
  130. extern char szNull[];
  131. extern char szComma[];
  132. extern char szSpace[];
  133. extern short wDateTime[]; // values for first 7 date/time items
  134. extern short wModulos[]; // highest value for hour, minute, second
  135. extern short wPrevDateTime[]; // only repaint fields if nec
  136. /* Help stuff */
  137. extern DWORD dwContext;
  138. extern WORD wHelpMessage;
  139. extern WORD wBrowseMessage;
  140. extern WORD wBrowseDoneMessage;
  141. // Originally from cpprn.c
  142. extern short nDisk;
  143. extern char szDrv[];
  144. extern char szDirOfSrc[]; // Directory for File copy
  145. extern WORD nConfID; // For conflict dialog
  146. //==========================================================================
  147. // Function Prototypes
  148. //==========================================================================
  149. /* utiltext.c */
  150. void GetDate (void);
  151. void GetTime (void);
  152. void SetDate (void);
  153. void SetTime (void);
  154. void SetDateTime (void); // [stevecat] - new functions
  155. void GetDateTime (void);
  156. DWORD AddStringToObject(DWORD dwStringObject, LPSTR lpszSrc, WORD wFlags);
  157. LPSTR BackslashTerm (LPSTR pszPath);
  158. void ErrMemDlg(HWND hParent);
  159. HANDLE FindRHSIni (LPSTR pFile, LPSTR pSection, LPSTR pRHS);
  160. int GetSection (LPSTR lpFile, LPSTR lpSection, LPHANDLE hSection);
  161. short myatoi(LPSTR pszInt);
  162. HANDLE StringToLocalHandle (LPSTR lpStr);
  163. #ifdef LATER
  164. void ErrWinDlg(HWND hParent);
  165. short Copy(HWND hParent, char *szSrcFile, char *szDestFile);
  166. #endif // LATER
  167. /* util.c */
  168. int DoDialogBoxParam(int nDlg, HWND hParent, WNDPROC lpProc,
  169. DWORD dwHelpContext, DWORD dwParam);
  170. void HourGlass (BOOL bOn);
  171. int MyMessageBox(HWND hWnd, DWORD wText, DWORD wCaption, DWORD wType, ...);
  172. void SendWinIniChange(LPSTR szSection);
  173. int strpos(LPSTR,char);
  174. char *strscan(char *, char *);
  175. void StripBlanks( char * );
  176. /* arrow.c */
  177. short ArrowVScrollProc(short wScroll, short nCurrent, LPARROWVSCROLL lpAVS);
  178. BOOL OddArrowWindow(HWND);
  179. // initapp.c (new) (Originally from control.c)
  180. BOOL AppletInit();
  181. // addfile.c (new) (Originally from cpprn.c)
  182. BOOL AddFileDlg (HWND hDlg, UINT message, DWORD wParam, LONG lParam);
  183. // conflict.c (new) (Originally from cpprn.c)
  184. BOOL ConflictDlg(HWND hDlg, UINT message, DWORD wParam, LONG lParam);
  185. #if DBG
  186. void DbgPrint( char *, ... );
  187. void DbgBreakPoint( void );
  188. #endif
  189.