home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / Chip_2002-02_cd1.bin / sharewar / apaths / APSOURCE.ZIP / AppPaths.h < prev    next >
C/C++ Source or Header  |  2001-03-26  |  19KB  |  451 lines

  1. /* AppPaths.h - March 26th, 2001
  2. **
  3. **      Copyright (c) 1997-2001 by Gregory Braun. All rights reserved.
  4. **
  5. **      This header defines the various data structure definitions,
  6. **      manifest constants and function prototypes used throughout
  7. **      the AppPaths Control Panel Applet project.
  8. **
  9. **      Include this header file in all project source code modules
  10. **      that reference AppPaths symbols.
  11. **
  12. **      This header is designed to be used as a precompiled header
  13. **      in an MS Visual C/C++ project. All MS Windows 95/98/NT/2000
  14. **      Win32 API headers required to build the project are included
  15. **      prior to AppPaths definitions.
  16. **
  17. **      Print this header file in the Landscape mode to display the
  18. **      full width of definitions.
  19. **
  20. */
  21.  
  22.  
  23. #ifndef APPPATHS_H                                          // include this header only once!
  24. #define APPPATHS_H                  APPPATHS_H
  25.  
  26. #define STRICT                                              // strong lint checks
  27.  
  28. #define _WIN32_IE                   0x0300                  // The application will be compatible with Comctl32.dll and
  29.                                                             // shell32.dll version 4.70 and later.
  30.  
  31. //  To prevent MS Windows NT v6.x headers from generating errors at Warning Level #4
  32.  
  33. #pragma warning (disable:4115)                              // named type definition in parentheses
  34. #pragma warning (disable:4201)                              // nonstandard extension used : nameless struct/union
  35. #pragma warning (disable:4214)                              // nonstandard extension used : bit field types other than int
  36. #pragma warning (disable:4514)                              // unreferenced inline function has been removed
  37.  
  38.  
  39.  
  40. #ifndef _INC_WINDOWS
  41. #include <Windows.h>                                        // Win32 API definitions.
  42. #endif
  43.  
  44. #ifndef _INC_WINDOWSX
  45. #include <WindowsX.h>                                       // Win32 API macros.
  46. #endif
  47.  
  48. #ifndef _INC_COMMDLG
  49. #include <CommDlg.h>                                        // Common dialog definitions.
  50. #endif
  51.  
  52. #pragma warning (disable:4115)                              // named type definition in parentheses
  53. #pragma warning (disable:4201)                              // nonstandard extension used : nameless struct/union
  54. #pragma warning (disable:4214)                              // nonstandard extension used : bit field types other than int
  55. #pragma warning (disable:4514)                              // unreferenced inline function has been removed
  56.  
  57. #ifndef _INC_COMMCTRL
  58. #include <CommCtrl.h>                                       // Common control definitions.
  59. #endif
  60.  
  61. #ifndef _INC_SHELLAPI
  62. #include <ShellAPI.h>                                       // Win32 Shell API definitions.
  63. #endif
  64.  
  65. #ifndef _SHLOBJ_H_
  66. #include <ShlObj.h>                                         // Win32 Shell Object API definitions.
  67. #endif
  68.  
  69. #ifndef _INC_REGSTR
  70. #include <RegStr.h>                                         // Win32 Registry API definitions.
  71. #endif
  72.  
  73. #ifndef _INC_CPL
  74. #include <cpl.h>                                            // MS Windows Control Panel definitions.
  75. #endif
  76.  
  77.  
  78.  
  79. #ifdef __cplusplus                                          // Don't mangle AppPaths symbols
  80. extern "C" {
  81. #endif
  82.  
  83. // --------------------------------------------------------------------------------------------------------------
  84.  
  85.  
  86. #define APP_CAPTION                 "Application Paths\0"
  87.  
  88. #define REGSTR_PATH_HELP            "Software\\Microsoft\\Windows\\Help\0"
  89.  
  90.  
  91. #define VARFILEINFO_STR             "\\VarFileInfo\\Translation\0"
  92. #define WIN_RES_FMT                 "\\StringFileInfo\\%04X04E4\\%s\0"
  93. #define UNI_RES_FMT                 "\\StringFileInfo\\%04X04B0\\%s\0"
  94. #define LNG_RES_FMT                 "\\StringFileInfo\\%08lX\\%s\0"
  95.  
  96.  
  97. // --------------------------------------------------------------------------------------------------------------
  98.  
  99.  
  100. #define IDC_STATIC                  (-1)                        // Static dialog resource ID
  101. #define UNUSED_ARG(x)               ((x) = (x))                 // for unused formal agruements
  102.  
  103.  
  104. #define NIL                         (0)                         // Zero... none
  105.  
  106.  
  107. #define PSTRING                     (0x0100)                    // Some safe string sizes!
  108. #define KSTRING                     (0x0400)
  109. #define MSTRING                     (0x0800)
  110.  
  111.  
  112. #define EOS                         ('\0')                      // C Language End-Of-String
  113. #define BLANK_STR                   ("\0")                      // Empty string
  114.  
  115. #define EXT_CHR                     ('.')
  116. #define HLP_EXT                     (".HLP")
  117.  
  118. #define WIZARD_PICT                 1000                        // AboutBox graphics (154 x 256 bitmap)
  119.  
  120. #define APPLICATION_ICON            1000                        // Control Panel Applet icon ID
  121. #define HELPFILE_ICON               2000                        // "HelpFile.ico"
  122. #define WINDOWS_ICON                3000                        // "Windows.ico"
  123.  
  124.  
  125. #define COLUMN_1                    0
  126. #define COLUMN_2                    1
  127. #define COLUMN_3                    2
  128.  
  129. #define PATH_COLS_MAX               3
  130. #define RUN_COLS_MAX                2
  131. #define SRV_COLS_MAX                2
  132. #define HELP_COLS_MAX               2
  133.  
  134. #define TAB_1                       0
  135. #define TAB_2                       1
  136. #define TAB_3                       2
  137. #define TAB_4                       3
  138. #define TAB_5                       4
  139.  
  140. #define RUN_MAX                     64
  141. #define SRV_MAX                     64
  142.  
  143.  
  144. //  PATH data structure definition - used with the PathTab ListView control.
  145. // --------------------------------------------------------------------------------------------------------------
  146. typedef struct tagPATH {
  147.                char                 name[PSTRING];
  148.                char                 application[PSTRING];
  149.                char                 path[KSTRING];
  150.                int                  index;
  151.                } PATH;
  152.  
  153. typedef PATH far *                  LPPATH;
  154.  
  155.  
  156. //  RUN data structure definition - used with the RunTab ListView control.
  157. // --------------------------------------------------------------------------------------------------------------
  158. typedef struct tagRUN {
  159.                char                 name[PSTRING];
  160.                char                 path[PSTRING];
  161.                int                  index;
  162.                } RUN;
  163.  
  164. typedef RUN far *                   LPRUN;
  165.  
  166.  
  167. //  SRV data structure definition - used with the RunTab ListView control.
  168. // --------------------------------------------------------------------------------------------------------------
  169. typedef struct tagSRV {
  170.                char                 name[PSTRING];
  171.                char                 path[PSTRING];
  172.                int                  index;
  173.                } SRV;
  174.  
  175. typedef SRV far *                   LPSRV;
  176.  
  177.  
  178. //  HELP data structure definition - used with the HelpTab ListView control.
  179. // --------------------------------------------------------------------------------------------------------------
  180. typedef struct tagHELP {
  181.                char                 name[PSTRING];
  182.                char                 path[PSTRING];
  183.                int                  index;
  184.                } HELP;
  185.  
  186. typedef HELP far *                  LPHELP;
  187.  
  188.  
  189. //  VERSION data structure definition - used with the AboutTab .
  190. // --------------------------------------------------------------------------------------------------------------
  191. #define VERSION_ITEM_MAX            7
  192.  
  193. typedef struct tagVERSION_ITEM {
  194.         char                        label[36];
  195.         char                        value[PSTRING];
  196.         int                         id;
  197.         char                        sub[PSTRING];
  198.         } VERSION_ITEM;
  199.  
  200. typedef struct tagVERSION {
  201.         VERSION_ITEM                item[VERSION_ITEM_MAX];
  202.         } VERSION;
  203.  
  204.  
  205.  
  206.  
  207. //  The following dialog box resources and control IDs are ordinal
  208. //  to facilitate easier Help project definitions.
  209.  
  210.  
  211. //  AppPaths string resource ID numbers.
  212. // --------------------------------------------------------------------------------------------------------------
  213. #define CPANEL_NAME                 100
  214. #define CPANEL_DESC                 101
  215.  
  216. #define APP_NAME                    102
  217. #define APP_COPYRIGHT               103
  218. #define APP_DESCRIPTION             104
  219. #define APP_VERSION                 105
  220. #define APP_RELEASE                 106
  221. #define APP_COMMENTS                107
  222. #define APP_WEBSITE                 108
  223.  
  224.  
  225. //  PathTab - AppPaths property sheet control IDs
  226. // --------------------------------------------------------------------------------------------------------------
  227. #define PATH_TAB                    1000
  228.  
  229. #define PATH_MEMBER_LST             101
  230. #define PATH_CREATE_BTN             102
  231. #define PATH_MODIFY_BTN             103
  232. #define PATH_REMOVE_BTN             104
  233.  
  234.  
  235. //  Path Editor Dialog Box resource IDs
  236. // --------------------------------------------------------------------------------------------------------------
  237. #define PATH_DLG                    2000
  238.  
  239. #define PATH_ICON_PIC               201
  240.  
  241. #define PATH_NAME_TXT               202
  242. #define PATH_APPLICATION_TXT        203
  243. #define PATH_PATH_TXT               204
  244.  
  245. #define PATH_APPLICATION_BTN        205
  246. #define PATH_PATH_BTN               206
  247.  
  248. #define PATH_HELP_BTN               207
  249.  
  250.  
  251. //  RunTab - Run property sheet control IDs
  252. // --------------------------------------------------------------------------------------------------------------
  253. #define RUN_TAB                     3000
  254.  
  255. #define RUN_MEMBER_LST              301
  256. #define RUN_MACHINE_BOX             302
  257. #define RUN_USER_BOX                303
  258.  
  259. #define RUN_CREATE_BTN              304
  260. #define RUN_MODIFY_BTN              305
  261. #define RUN_REMOVE_BTN              306
  262.  
  263.  
  264. //  Run Editor Dialog Box resource IDs
  265. // --------------------------------------------------------------------------------------------------------------
  266. #define RUN_DLG                     4000
  267.  
  268. #define RUN_ICON_PIC                401
  269.  
  270. #define RUN_NAME_TXT                402
  271. #define RUN_PATH_TXT                403
  272.  
  273. #define RUN_PATH_BTN                404
  274.  
  275. #define RUN_HELP_BTN                405
  276.  
  277.  
  278. //  ServicesTab - Services property sheet control IDs
  279. // --------------------------------------------------------------------------------------------------------------
  280. #define SRV_TAB                     5000
  281.  
  282. #define SRV_MEMBER_LST              501
  283.  
  284. #define SRV_CREATE_BTN              502
  285. #define SRV_MODIFY_BTN              503
  286. #define SRV_REMOVE_BTN              504
  287.  
  288.  
  289. //  Service Editor Dialog Box resource IDs
  290. // --------------------------------------------------------------------------------------------------------------
  291. #define SRV_DLG                     6000
  292.  
  293. #define SRV_ICON_PIC                601
  294.  
  295. #define SRV_NAME_TXT                602
  296. #define SRV_PATH_TXT                603
  297.  
  298. #define SRV_PATH_BTN                604
  299.  
  300. #define SRV_HELP_BTN                605
  301.  
  302.  
  303. //  HelpTab - HelpFiles property sheet control IDs
  304. // --------------------------------------------------------------------------------------------------------------
  305. #define HELP_TAB                    7000
  306.  
  307. #define HELP_MEMBER_LST             701
  308. #define HELP_CREATE_BTN             702
  309. #define HELP_MODIFY_BTN             703
  310. #define HELP_REMOVE_BTN             704
  311.  
  312.  
  313. //  Help Editor Dialog Box resource IDs
  314. // --------------------------------------------------------------------------------------------------------------
  315. #define HELP_DLG                    8000
  316.  
  317. #define HELP_NAME_TXT               801
  318. #define HELP_PATH_TXT               802
  319.  
  320. #define HELP_PATH_BTN               803
  321.  
  322. #define HELP_HELP_BTN               804
  323.  
  324.  
  325. //  AboutTab - About box property sheet control IDs
  326. // --------------------------------------------------------------------------------------------------------------
  327. #define ABOUT_TAB                   9000
  328.  
  329. #define ABOUT_WIZARD_PIC            900
  330. #define ABOUT_ICON_PIC              901
  331. #define ABOUT_NAME_TXT              902
  332. #define ABOUT_COPYRIGHT_TXT         903
  333. #define ABOUT_DESCRIPTION_TXT       904
  334. #define ABOUT_VERSION_TXT           905
  335. #define ABOUT_RELEASE_TXT           906
  336. #define ABOUT_COMMENTS_TXT          907
  337. #define ABOUT_WEBSITE_BTN           908
  338.  
  339.  
  340.  
  341. //  Global AppPaths variables ===================================================================================
  342.  
  343. extern HINSTANCE far                applet;             // Control Panel applet instance handle.
  344. extern char far                     program[PSTRING];   // Module name
  345. extern char far                     helpfile[PSTRING];  // Module help filespec.
  346.  
  347.  
  348. //  External (global) AppPaths function prototypes ==============================================================
  349.  
  350. //      The following functions and procedures are found in files having the
  351. //      same name as the routine itself.
  352.  
  353.  
  354. BOOL WINAPI                         DllMain             (HINSTANCE instance,ULONG type,LPVOID reserved);
  355. LONG CALLBACK                       CPlApplet           (HWND w,UINT msg,LONG wp,LONG lp);
  356.  
  357. extern BOOL                         Property            (HWND w);
  358.  
  359. extern UINT CALLBACK                PathTab             (HWND w,UINT msg,WPARAM wp,LPARAM lp);
  360. extern UINT CALLBACK                RunTab              (HWND w,UINT msg,WPARAM wp,LPARAM lp);
  361. extern UINT CALLBACK                ServiceTab          (HWND w,UINT msg,WPARAM wp,LPARAM lp);
  362. extern UINT CALLBACK                HelpTab             (HWND w,UINT msg,WPARAM wp,LPARAM lp);
  363. extern UINT CALLBACK                AboutTab            (HWND w,UINT msg,WPARAM wp,LPARAM lp);
  364.  
  365. extern BOOL far                     GetPKeys            (HWND list);
  366. extern BOOL far                     GetPString          (LPCSTR section,LPCSTR label,LPCSTR def,LPSTR value,DWORD size);
  367. extern BOOL far                     KillPKey            (LPPATH path);
  368. extern BOOL far                     MakePKey            (LPPATH path);
  369.  
  370. extern BOOL far                     GetRKeys            (HWND list,BOOL user);
  371. extern BOOL far                     KillRKey            (LPRUN run,BOOL user);
  372. extern BOOL far                     MakeRKey            (LPRUN run,BOOL user);
  373.  
  374. extern BOOL far                     GetHKeys            (HWND list);
  375. extern BOOL far                     KillHKey            (LPHELP help);
  376. extern BOOL far                     MakeHKey            (LPHELP help);
  377.  
  378. extern BOOL far                     GetSKeys            (HWND list);
  379. extern BOOL far                     KillSKey            (LPSRV srv);
  380. extern BOOL far                     MakeSKey            (LPSRV srv);
  381.  
  382. extern BOOL far                     EditPath            (HWND w,LPPATH path);
  383. extern BOOL far                     EditRun             (HWND w,LPRUN run);
  384. extern BOOL far                     EditService         (HWND w,LPSRV srv);
  385. extern BOOL far                     EditHelp            (HWND w,LPHELP help);
  386.  
  387. extern BOOL far                     PickApp             (HWND w,LPSTR filespec);
  388. extern BOOL far                     PickPath            (HWND w,LPCSTR msg,LPSTR path);
  389.  
  390. extern LPSTR far                    SysError            (DWORD err,LPSTR string);
  391.  
  392. extern BOOL far                     WebSite             (HWND w,LPCSTR website);
  393.  
  394. extern BOOL far                     HelpTopic           (HWND w,DWORD id);
  395. extern BOOL far                     HelpTip             (HWND w,int id);
  396.  
  397. extern LPSTR far                    lstrrchr            (LPSTR string,int c);
  398.  
  399. //  LV_Help.c ---------------------------------------------------------------------------------------------------
  400.  
  401. extern int far                      LV_RowHit           (HWND list);
  402. extern int far                      LV_GetCurSel        (HWND list);
  403. extern int far                      LV_SetCurSel        (HWND list,int index);
  404.  
  405. //  PL_Help.c ---------------------------------------------------------------------------------------------------
  406.  
  407. extern BOOL far                     PL_GetItem          (HWND list,int index,LPPATH path);
  408. extern BOOL far                     PL_PutItem          (HWND list,int index,LPPATH path);
  409. extern BOOL far                     PL_AddItem          (HWND list,LPPATH path);
  410.  
  411. //  RL_Help.c ---------------------------------------------------------------------------------------------------
  412.  
  413. extern BOOL far                     RL_GetItem          (HWND list,int index,LPRUN run);
  414. extern BOOL far                     RL_PutItem          (HWND list,int index,LPRUN run);
  415. extern BOOL far                     RL_AddItem          (HWND list,LPRUN run);
  416.  
  417. //  SL_Help.c ---------------------------------------------------------------------------------------------------
  418.  
  419. extern BOOL far                     SL_GetItem          (HWND list,int index,LPSRV srv);
  420. extern BOOL far                     SL_PutItem          (HWND list,int index,LPSRV srv);
  421. extern BOOL far                     SL_AddItem          (HWND list,LPSRV srv);
  422.  
  423. //  HL_Help.c ---------------------------------------------------------------------------------------------------
  424.  
  425. extern BOOL far                     HL_GetItem          (HWND list,int index,LPHELP help);
  426. extern BOOL far                     HL_PutItem          (HWND list,int index,LPHELP help);
  427. extern BOOL far                     HL_AddItem          (HWND list,LPHELP help);
  428.  
  429. //  DlgHelp.c ---------------------------------------------------------------------------------------------------
  430.  
  431. extern BOOL far                     SetDlgIcon          (HWND dlg,int id);
  432. extern BOOL far                     SetDFocus           (HWND dlg,int item);
  433. extern BOOL far                     SetDlgItemSize      (HWND dlg,int item,DWORD size);
  434.  
  435. //  Messages.c --------------------------------------------------------------------------------------------------
  436.  
  437. extern BOOL far                     Message             (HWND w,LPCSTR caption,LPCSTR message);
  438. extern BOOL far                     Error               (HWND w,LPCSTR caption,LPCSTR message);
  439. extern BOOL far                     Query               (HWND w,LPCSTR caption,LPCSTR message);
  440. extern BOOL far                     Beeper              (void);
  441.  
  442.  
  443. #ifdef __cplusplus
  444. }
  445. #endif
  446.  
  447. #endif
  448.  
  449.  
  450. /* end of AppPaths.h - written by Gregory Braun */
  451.