home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / cpl.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  8.2 KB  |  215 lines

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