home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / sdk / winh / cpl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-11  |  7.9 KB  |  206 lines

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