home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / cpl.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  8KB  |  213 lines

  1.  
  2. /*****************************************************************************\
  3. *                                                                             *
  4. * cpl.h -       Control panel extension DLL definitions                       *
  5. *                                                                             *
  6. *               Version 3.10                                                  *
  7. *                                                                             *
  8. *               Copyright 1992 - 1998 Microsoft Corp.  All rights reserved *
  9. *                                                                             *
  10. ******************************************************************************/
  11. /*
  12. *  General rules for being installed in the Control Panel:
  13. *
  14. *      1) The DLL must export a function named CPlApplet which will handle
  15. *         the messages discussed below.
  16. *      2) If the applet needs to save information in CONTROL.INI minimize
  17. *         clutter by using the application name [MMCPL.appletname].
  18. *      2) If the applet is refrenced in CONTROL.INI under [MMCPL] use
  19. *         the following form:
  20. *              ...
  21. *              [MMCPL]
  22. *              uniqueName=c:\mydir\myapplet.dll
  23. *              ...
  24. *
  25. *
  26. *  The order applet DLL's are loaded by CONTROL.EXE is not guaranteed.
  27. *  Control panels may be sorted for display, etc.
  28. *
  29. */
  30. #ifndef _INC_CPL
  31. #define _INC_CPL
  32.  
  33.  
  34. #include <pshpack1.h>   /* Assume byte packing throughout */
  35.  
  36. #ifdef __cplusplus
  37. extern "C" {            /* Assume C declarations for C++ */
  38. #endif /* __cplusplus */
  39.  
  40. /*
  41.  * CONTROL.EXE will answer this message and launch an applet
  42.  *
  43.  * WM_CPL_LAUNCH
  44.  *
  45.  *      wParam      - window handle of calling app
  46.  *      lParam      - LPTSTR of name of applet to launch
  47.  *
  48.  * WM_CPL_LAUNCHED
  49.  *
  50.  *      wParam      - TRUE/FALSE if applet was launched
  51.  *      lParam      - NULL
  52.  *
  53.  * CONTROL.EXE will post this message to the caller when the applet returns
  54.  * (ie., when wParam is a valid window handle)
  55.  *
  56.  */
  57. #define WM_CPL_LAUNCH   (WM_USER+1000)
  58. #define WM_CPL_LAUNCHED (WM_USER+1001)
  59.  
  60. /* A function prototype for CPlApplet() */
  61.  
  62. //typedef LRESULT (APIENTRY *APPLET_PROC)(HWND hwndCpl, UINT msg, LPARAM lParam1, LPARAM lParam2);
  63. typedef LONG (APIENTRY *APPLET_PROC)(HWND hwndCpl, UINT msg, LONG lParam1, LONG lParam2);
  64.  
  65. /* The data structure CPlApplet() must fill in. */
  66.  
  67. typedef struct tagCPLINFO
  68. {
  69.     int     idIcon;     /* icon resource id, provided by CPlApplet() */
  70.     int     idName;     /* name string res. id, provided by CPlApplet() */
  71.     int     idInfo;     /* info string res. id, provided by CPlApplet() */
  72.     LONG    lData;      /* user defined data */
  73. } CPLINFO, *LPCPLINFO;
  74.  
  75. typedef struct tagNEWCPLINFOA
  76. {
  77.     DWORD   dwSize;         /* similar to the commdlg */
  78.     DWORD   dwFlags;
  79.     DWORD   dwHelpContext;  /* help context to use */
  80.     LONG    lData;          /* user defined data */
  81.     HICON   hIcon;          /* icon to use, this is owned by CONTROL.EXE (may be deleted) */
  82.     CHAR    szName[32];     /* short name */
  83.     CHAR    szInfo[64];     /* long name (status line) */
  84.     CHAR    szHelpFile[128];/* path to help file to use */
  85. } NEWCPLINFOA, *LPNEWCPLINFOA;
  86. typedef struct tagNEWCPLINFOW
  87. {
  88.     DWORD   dwSize;         /* similar to the commdlg */
  89.     DWORD   dwFlags;
  90.     DWORD   dwHelpContext;  /* help context to use */
  91.     LONG    lData;          /* user defined data */
  92.     HICON   hIcon;          /* icon to use, this is owned by CONTROL.EXE (may be deleted) */
  93.     WCHAR   szName[32];     /* short name */
  94.     WCHAR   szInfo[64];     /* long name (status line) */
  95.     WCHAR   szHelpFile[128];/* path to help file to use */
  96. } NEWCPLINFOW, *LPNEWCPLINFOW;
  97. #ifdef UNICODE
  98. typedef NEWCPLINFOW NEWCPLINFO;
  99. typedef LPNEWCPLINFOW LPNEWCPLINFO;
  100. #else
  101. typedef NEWCPLINFOA NEWCPLINFO;
  102. typedef LPNEWCPLINFOA LPNEWCPLINFO;
  103. #endif // UNICODE
  104.  
  105. #if(WINVER >= 0x0400)
  106. #define CPL_DYNAMIC_RES 0
  107. // This constant may be used in place of real resource IDs for the idIcon,
  108. // idName or idInfo members of the CPLINFO structure.  Normally, the system
  109. // uses these values to extract copies of the resources and store them in a
  110. // cache.  Once the resource information is in the cache, the system does not
  111. // need to load a CPL unless the user actually tries to use it.
  112. // CPL_DYNAMIC_RES tells the system not to cache the resource, but instead to
  113. // load the CPL every time it needs to display information about an item.  This
  114. // allows a CPL to dynamically decide what information will be displayed, but
  115. // is SIGNIFICANTLY SLOWER than displaying information from a cache.
  116. // Typically, CPL_DYNAMIC_RES is used when a control panel must inspect the
  117. // runtime status of some device in order to provide text or icons to display.
  118.  
  119. #endif /* WINVER >= 0x0400 */
  120.  
  121. /* The messages CPlApplet() must handle: */
  122.  
  123. #define CPL_INIT        1
  124. /*  This message is sent to indicate CPlApplet() was found. */
  125. /*  lParam1 and lParam2 are not defined. */
  126. /*  Return TRUE or FALSE indicating whether the control panel should proceed. */
  127.  
  128. #define CPL_GETCOUNT    2
  129. /*  This message is sent to determine the number of applets to be displayed. */
  130. /*  lParam1 and lParam2 are not defined. */
  131. /*  Return the number of applets you wish to display in the control */
  132. /*  panel window. */
  133.  
  134.  
  135. #define CPL_INQUIRE     3
  136. /*  This message is sent for information about each applet. */
  137.  
  138. /*  A CPL SHOULD HANDLE BOTH THE CPL_INQUIRE AND CPL_NEWINQUIRE MESSAGES. */
  139. /*  The developer must not make any assumptions about the order or dependance */
  140. /*  of CPL inquiries. */
  141.  
  142. /*  lParam1 is the applet number to register, a value from 0 to */
  143. /*  (CPL_GETCOUNT - 1).  lParam2 is a far ptr to a CPLINFO structure. */
  144. /*  Fill in CPLINFO's idIcon, idName, idInfo and lData fields with */
  145. /*  the resource id for an icon to display, name and description string ids, */
  146. /*  and a long data item associated with applet #lParam1.  This information */
  147. /*  may be cached by the caller at runtime and/or across sessions. */
  148. /*  To prevent caching, see CPL_DYNAMIC_RES, above.  */
  149.  
  150.  
  151. #define CPL_SELECT      4
  152. /*  The CPL_SELECT message has been deleted. */
  153.  
  154.  
  155. #define CPL_DBLCLK      5
  156. /*  This message is sent when the applet's icon has been double-clicked */
  157. /*  upon.  lParam1 is the applet number which was selected.  lParam2 is the */
  158. /*  applet's lData value. */
  159. /*  This message should initiate the applet's dialog box. */
  160.  
  161.  
  162. #define CPL_STOP        6
  163. /*  This message is sent for each applet when the control panel is exiting. */
  164. /*  lParam1 is the applet number.  lParam2 is the applet's lData  value. */
  165. /*  Do applet specific cleaning up here. */
  166.  
  167.  
  168. #define CPL_EXIT        7
  169. /*  This message is sent just before the control panel calls FreeLibrary. */
  170. /*  lParam1 and lParam2 are not defined. */
  171. /*  Do non-applet specific cleaning up here. */
  172.  
  173.  
  174. #define CPL_NEWINQUIRE    8
  175. /* Same as CPL_INQUIRE execpt lParam2 is a pointer to a NEWCPLINFO struct. */
  176.  
  177. /*  A CPL SHOULD HANDLE BOTH THE CPL_INQUIRE AND CPL_NEWINQUIRE MESSAGES. */
  178. /*  The developer must not make any assumptions about the order or dependance */
  179. /*  of CPL inquiries. */
  180.  
  181. #if(WINVER >= 0x0400)
  182. #define CPL_STARTWPARMSA 9
  183. #define CPL_STARTWPARMSW 10
  184. #ifdef UNICODE
  185. #define CPL_STARTWPARMS CPL_STARTWPARMSW
  186. #else
  187. #define CPL_STARTWPARMS CPL_STARTWPARMSA
  188. #endif
  189.  
  190. /* this message parallels CPL_DBLCLK in that the applet should initiate
  191. ** its dialog box.  where it differs is that this invocation is coming
  192. ** out of RUNDLL, and there may be some extra directions for execution.
  193. ** lParam1: the applet number.
  194. ** lParam2: an LPSTR to any extra directions that might exist.
  195. ** returns: TRUE if the message was handled; FALSE if not.
  196. */
  197. #endif /* WINVER >= 0x0400 */
  198.  
  199.  
  200. /* This message is internal to the Control Panel and MAIN applets.  */
  201. /* It is only sent when an applet is invoked from the Command line  */
  202. /* during system installation.                                      */
  203. #define CPL_SETUP               200
  204.  
  205. #ifdef __cplusplus
  206. }
  207. #endif    /* __cplusplus */
  208.  
  209. #include <poppack.h>
  210.  
  211. #endif  /* _INC_CPL */
  212.  
  213.