home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 6.ddi / WINCLUDE.ZIP / CPL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  5.9 KB  |  165 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. * cpl.h -       Control panel extension DLL definitions                       *
  4. *                                                                             *
  5. *               Version 3.10                                                  *
  6. *                                                                             *
  7. ******************************************************************************
  8. *  General rules for being installed in the Control Panel:
  9. *
  10. *      1) The DLL must export a function named CPlApplet which will handle
  11. *         the messages discussed below.
  12. *      2) If the applet needs to save information in CONTROL.INI minimize
  13. *         clutter by using the application name [MMCPL.appletname].
  14. *      2) If the applet is refrenced in CONTROL.INI under [MMCPL] use
  15. *         the following form:
  16. *              ...
  17. *              [MMCPL]
  18. *              uniqueName=c:\mydir\myapplet.dll
  19. *              ...
  20. *
  21. *
  22. *  The order applet DLL's are loaded by CONTROL.EXE is:
  23. *
  24. *      1) MAIN.CPL is loaded from the windows system directory.
  25. *
  26. *      2) Installable drivers that are loaded and export the
  27. *         CplApplet() routine.
  28. *
  29. *      3) DLL's specified in the [MMCPL] section of CONTROL.INI.
  30. *
  31. *      4) DLL's named *.CPL from windows system directory.
  32. *
  33. */
  34.  
  35. #ifndef __CPL_H         /* prevent multiple includes */
  36. #define __CPL_H
  37.  
  38. #ifndef __WINDOWS_H
  39. #include <windows.h>    /* <windows.h> must be included */
  40. #endif  /* __WINDOWS_H */
  41.  
  42. #if !defined(WINVER) || (WINVER < 0x030a)
  43. #error Control panel extensions require Windows 3.1
  44. #endif
  45.  
  46. #ifndef RC_INVOKED
  47. #pragma option -a-      /* Assume byte packing throughout */
  48. #endif  /* RC_INVOKED */
  49.  
  50. #ifdef __cplusplus
  51. extern "C" {            /* Assume C declarations for C++ */
  52. #endif  /* __cplusplus */
  53.  
  54. /*
  55.  * CONTROL.EXE will answer this message and launch an applet
  56.  *
  57.  * WM_CPL_LAUNCH
  58.  *
  59.  *      wParam      - window handle of calling app
  60.  *      lParam      - LPSTR of name of applet to launch
  61.  *
  62.  * WM_CPL_LAUNCHED
  63.  *
  64.  *      wParam      - TRUE/FALSE if applet was launched
  65.  *      lParam      - NULL
  66.  *
  67.  * CONTROL.EXE will post this message to the caller when the applet returns
  68.  * (ie., when wParam is a valid window handle)
  69.  *
  70.  */
  71. #define WM_CPL_LAUNCH   (WM_USER+1000)
  72. #define WM_CPL_LAUNCHED (WM_USER+1001)
  73.  
  74. /* A function prototype for CPlApplet() */
  75.  
  76. typedef LRESULT (CALLBACK *APPLET_PROC)(HWND hwndCpl, UINT msg, LPARAM lParam1, LPARAM lParam2);
  77.  
  78. /* The data structure CPlApplet() must fill in. */
  79.  
  80. typedef struct tagCPLINFO
  81. {
  82.     int     idIcon;     /* icon resource id, provided by CPlApplet() */
  83.     int     idName;     /* name string res. id, provided by CPlApplet() */
  84.     int     idInfo;     /* info string res. id, provided by CPlApplet() */
  85.     LONG    lData;      /* user defined data */
  86. } CPLINFO, *PCPLINFO, FAR *LPCPLINFO;
  87.  
  88. typedef struct tagNEWCPLINFO
  89. {
  90.     DWORD       dwSize;         /* similar to the commdlg */
  91.     DWORD       dwFlags;
  92.     DWORD       dwHelpContext;  /* help context to use */
  93.     LONG        lData;          /* user defined data */
  94.     HICON       hIcon;          /* icon to use, this is owned by CONTROL.EXE (may be deleted) */
  95.     char        szName[32];     /* short name */
  96.     char        szInfo[64];     /* long name (status line) */
  97.     char        szHelpFile[128];/* path to help file to use */
  98. } NEWCPLINFO, *PNEWCPLINFO, FAR *LPNEWCPLINFO;
  99.  
  100.  
  101. /* The messages CPlApplet() must handle: */
  102.  
  103. #define CPL_INIT        1
  104. /*  This message is sent to indicate CPlApplet() was found. */
  105. /*  lParam1 and lParam2 are not defined. */
  106. /*  Return TRUE or FALSE indicating whether the control panel should proceed. */
  107.  
  108.  
  109. #define CPL_GETCOUNT    2
  110. /*  This message is sent to determine the number of applets to be displayed. */
  111. /*  lParam1 and lParam2 are not defined. */
  112. /*  Return the number of applets you wish to display in the control */
  113. /*  panel window. */
  114.  
  115.  
  116. #define CPL_INQUIRE     3
  117. /*  This message is sent for information about each applet. */
  118. /*  lParam1 is the applet number to register, a value from 0 to */
  119. /*  (CPL_GETCOUNT - 1).  lParam2 is a far ptr to a CPLINFO structure. */
  120. /*  Fill in CPL_INFO's idIcon, idName, idInfo and lData fields with */
  121. /*  the resource id for an icon to display, name and description string ids, */
  122. /*  and a long data item associated with applet #lParam1. */
  123.  
  124.  
  125. #define CPL_SELECT      4
  126. /*  This message is sent when the applet's icon has been clicked upon. */
  127. /*  lParam1 is the applet number which was selected.  lParam2 is the */
  128. /*  applet's lData value. */
  129.  
  130.  
  131. #define CPL_DBLCLK      5
  132. /*  This message is sent when the applet's icon has been double-clicked */
  133. /*  upon.  lParam1 is the applet number which was selected.  lParam2 is the */
  134. /*  applet's lData value. */
  135. /*  This message should initiate the applet's dialog box. */
  136.  
  137.  
  138. #define CPL_STOP        6
  139. /*  This message is sent for each applet when the control panel is exiting. */
  140. /*  lParam1 is the applet number.  lParam2 is the applet's lData  value. */
  141. /*  Do applet specific cleaning up here. */
  142.  
  143.  
  144. #define CPL_EXIT        7
  145. /*  This message is sent just before the control panel calls FreeLibrary. */
  146. /*  lParam1 and lParam2 are not defined. */
  147. /*  Do non-applet specific cleaning up here. */
  148.  
  149.  
  150. #define CPL_NEWINQUIRE  8
  151. /* this is the same as CPL_INQUIRE execpt lParam2 is a pointer to a */
  152. /* NEWCPLINFO structure.  this will be sent before the CPL_INQUIRE */
  153. /* and if it is responed to (return != 0) CPL_INQUIRE will not be sent */
  154.  
  155.  
  156. #ifdef __cplusplus
  157. }                       /* End of extern "C" { */
  158. #endif  /* __cplusplus */
  159.  
  160. #ifndef RC_INVOKED
  161. #pragma option -a.      /* Revert to default packing */
  162. #endif  /* RC_INVOKED */
  163.  
  164. #endif  /* __CPL_H */
  165.