home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / win32 / Cpl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-08  |  8.1 KB  |  212 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. * cpl.h -       Control panel extension DLL definitions                       *
  4. *                                                                             *
  5. *               Version 3.10                                                  *
  6. *                                                                             *
  7. *               Copyright (c) 1992-1996, Microsoft Corp.  All rights reserved *
  8. *                                                                             *
  9. ******************************************************************************/
  10. /*
  11. *  General rules for being installed in the Control Panel:
  12. *
  13. *      1) The DLL must export a function named CPlApplet which will handle
  14. *         the messages discussed below.
  15. *      2) If the applet needs to save information in CONTROL.INI minimize
  16. *         clutter by using the application name [MMCPL.appletname].
  17. *      2) If the applet is refrenced in CONTROL.INI under [MMCPL] use
  18. *         the following form:
  19. *              ...
  20. *              [MMCPL]
  21. *              uniqueName=c:\mydir\myapplet.dll
  22. *              ...
  23. *
  24. *
  25. *  The order applet DLL's are loaded by CONTROL.EXE is not guaranteed.
  26. *  Control panels may be sorted for display, etc.
  27. *
  28. */
  29. #ifndef _INC_CPL
  30. #define _INC_CPL
  31.  
  32.  
  33. #include <pshpack1.h>   /* Assume byte packing throughout */
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {            /* Assume C declarations for C++ */
  37. #endif /* __cplusplus */
  38.  
  39. /*
  40.  * CONTROL.EXE will answer this message and launch an applet
  41.  *
  42.  * WM_CPL_LAUNCH
  43.  *
  44.  *      wParam      - window handle of calling app
  45.  *      lParam      - LPTSTR of name of applet to launch
  46.  *
  47.  * WM_CPL_LAUNCHED
  48.  *
  49.  *      wParam      - TRUE/FALSE if applet was launched
  50.  *      lParam      - NULL
  51.  *
  52.  * CONTROL.EXE will post this message to the caller when the applet returns
  53.  * (ie., when wParam is a valid window handle)
  54.  *
  55.  */
  56. #define WM_CPL_LAUNCH   (WM_USER+1000)
  57. #define WM_CPL_LAUNCHED (WM_USER+1001)
  58.  
  59. /* A function prototype for CPlApplet() */
  60.  
  61. //typedef LRESULT (APIENTRY *APPLET_PROC)(HWND hwndCpl, UINT msg, LPARAM lParam1, LPARAM lParam2);
  62. typedef LONG (APIENTRY *APPLET_PROC)(HWND hwndCpl, UINT msg, LONG lParam1, LONG lParam2);
  63.  
  64. /* The data structure CPlApplet() must fill in. */
  65.  
  66. typedef struct tagCPLINFO
  67. {
  68.     int     idIcon;     /* icon resource id, provided by CPlApplet() */
  69.     int     idName;     /* name string res. id, provided by CPlApplet() */
  70.     int     idInfo;     /* info string res. id, provided by CPlApplet() */
  71.     LONG    lData;      /* user defined data */
  72. } CPLINFO, *LPCPLINFO;
  73.  
  74. typedef struct tagNEWCPLINFOA
  75. {
  76.     DWORD   dwSize;         /* similar to the commdlg */
  77.     DWORD   dwFlags;
  78.     DWORD   dwHelpContext;  /* help context to use */
  79.     LONG    lData;          /* user defined data */
  80.     HICON   hIcon;          /* icon to use, this is owned by CONTROL.EXE (may be deleted) */
  81.     CHAR    szName[32];     /* short name */
  82.     CHAR    szInfo[64];     /* long name (status line) */
  83.     CHAR    szHelpFile[128];/* path to help file to use */
  84. } NEWCPLINFOA, *LPNEWCPLINFOA;
  85. typedef struct tagNEWCPLINFOW
  86. {
  87.     DWORD   dwSize;         /* similar to the commdlg */
  88.     DWORD   dwFlags;
  89.     DWORD   dwHelpContext;  /* help context to use */
  90.     LONG    lData;          /* user defined data */
  91.     HICON   hIcon;          /* icon to use, this is owned by CONTROL.EXE (may be deleted) */
  92.     WCHAR   szName[32];     /* short name */
  93.     WCHAR   szInfo[64];     /* long name (status line) */
  94.     WCHAR   szHelpFile[128];/* path to help file to use */
  95. } NEWCPLINFOW, *LPNEWCPLINFOW;
  96. #ifdef UNICODE
  97. typedef NEWCPLINFOW NEWCPLINFO;
  98. typedef LPNEWCPLINFOW LPNEWCPLINFO;
  99. #else
  100. typedef NEWCPLINFOA NEWCPLINFO;
  101. typedef LPNEWCPLINFOA LPNEWCPLINFO;
  102. #endif // UNICODE
  103.  
  104. #if(WINVER >= 0x0400)
  105. #define CPL_DYNAMIC_RES 0
  106. // This constant may be used in place of real resource IDs for the idIcon,
  107. // idName or idInfo members of the CPLINFO structure.  Normally, the system
  108. // uses these values to extract copies of the resources and store them in a
  109. // cache.  Once the resource information is in the cache, the system does not
  110. // need to load a CPL unless the user actually tries to use it.
  111. // CPL_DYNAMIC_RES tells the system not to cache the resource, but instead to
  112. // load the CPL every time it needs to display information about an item.  This
  113. // allows a CPL to dynamically decide what information will be displayed, but
  114. // is SIGNIFICANTLY SLOWER than displaying information from a cache.
  115. // Typically, CPL_DYNAMIC_RES is used when a control panel must inspect the
  116. // runtime status of some device in order to provide text or icons to display.
  117.  
  118. #endif /* WINVER >= 0x0400 */
  119.  
  120. /* The messages CPlApplet() must handle: */
  121.  
  122. #define CPL_INIT        1
  123. /*  This message is sent to indicate CPlApplet() was found. */
  124. /*  lParam1 and lParam2 are not defined. */
  125. /*  Return TRUE or FALSE indicating whether the control panel should proceed. */
  126.  
  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.