home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l406 / 3.ddi / CNTR.H_ / CNTR.bin
Encoding:
Text File  |  1992-10-21  |  8.1 KB  |  245 lines

  1. //---------------------------------------------------------------------------
  2. //        Copyright (C) 1991-92, Microsoft Corporation
  3. //
  4. // You have a royalty-free right to use, modify, reproduce and distribute
  5. // the Sample Custom Control Files (and/or any modified version) in any way
  6. // you find useful, provided that you agree that Microsoft has no warranty,
  7. // obligation or liability for any Custom Control File.
  8. //---------------------------------------------------------------------------
  9. // Cntr.h
  10. //---------------------------------------------------------------------------
  11.  
  12. //---------------------------------------------------------------------------
  13. // Resource Information
  14. //---------------------------------------------------------------------------
  15. // Toolbox bitmap resource IDs numbers.
  16. //---------------------------------------------------------------------------
  17. #define IDBMP_CNTR        8000
  18. #define IDBMP_CNTRDOWN        8001
  19. #define IDBMP_CNTRMONO        8003
  20. #define IDBMP_CNTREGA        8006
  21.  
  22.  
  23. //---------------------------------------------------------------------------
  24. // Change these for each new VBX file
  25. //---------------------------------------------------------------------------
  26. #define VBX_COMPANYNAME        "Microsoft Corporation\0"
  27. #define VBX_FILEDESCRIPTION       "Visual Basic Counter Custom Control Example\0"
  28. #define VBX_INTERNALNAME       "CNTR\0"
  29. #define VBX_LEGALCOPYRIGHT       "Copyright \251 Microsoft Corp. 1991-92\0"
  30. #define VBX_LEGALTRADEMARKS       "Microsoft\256 is a registered trademark of Microsoft Corporation. Visual Basic\231 is a trademark of Microsoft Corporation. Windows\231 is a trademark of Microsoft Corporation.\0"
  31. #define VBX_ORIGINALFILENAME       "CNTR.VBX\0"
  32. #define VBX_PRODUCTNAME        "Microsoft\256 Visual Basic\231 for Windows\231\0"
  33.  
  34.  
  35. //---------------------------------------------------------------------------
  36. // Update these fields for each build.
  37. //---------------------------------------------------------------------------
  38. #define VBX_VERSION            2,00,6,01
  39. #define VBX_VERSION_STR        "2.00.601\0"
  40.  
  41.  
  42. #ifndef RC_INVOKED
  43. //---------------------------------------------------------------------------
  44. // Macro for referencing member of structure
  45. //---------------------------------------------------------------------------
  46. #define OFFSETIN(struc, field)        ((USHORT)&(((struc *)0)->field))
  47.  
  48.  
  49. //---------------------------------------------------------------------------
  50. // Cntr control data and structs
  51. //---------------------------------------------------------------------------
  52. _segment segCntr;
  53.  
  54. #define BP _based(segCntr) *    // based pointer
  55.  
  56. #define BH BP BP        // based handle
  57.  
  58. typedef VOID BH BHVOID;     // void handle
  59.  
  60. typedef CHAR BH BHSTR;        // handle to a string
  61.  
  62. typedef struct tagCNTR
  63.     {
  64.     HFONT   hFont;
  65.     float   Value;
  66.     CHAR    szVal[13];
  67.     SHORT   DigitsLeft;
  68.     SHORT   DigitsRight;
  69.     LONG    colorBackRight;
  70.     LONG    colorForeRight;
  71.     SHORT   DigitWidth;
  72.     SHORT   StartRoll;
  73.     SHORT   RollVal;
  74.     SHORT   Gap;
  75.     HBITMAP hbmp[2];
  76.     } CNTR;
  77.  
  78. typedef CNTR BP BPCNTR;
  79.  
  80. #define BpcntrDEREF(hctl)     ((BPCNTR)(VOID *)(SHORT)(LONG)VBDerefControl(hctl))
  81.  
  82.  
  83. //---------------------------------------------------------------------------
  84. // Control Procedure
  85. //---------------------------------------------------------------------------
  86. LONG FAR PASCAL _export CntrCtlProc(HCTL, HWND, USHORT, USHORT, LONG);
  87.  
  88.  
  89. //---------------------------------------------------------------------------
  90. // Property info
  91. //---------------------------------------------------------------------------
  92. PROPINFO propinfoCntrBackColorRight =
  93.     {
  94.     "BackColorRight",
  95.     DT_COLOR | PF_fGetData | PF_fSetData | PF_fSetMsg | PF_fSaveData,
  96.     OFFSETIN(CNTR,colorBackRight), 0
  97.     };
  98.  
  99. PROPINFO propinfoCntrDigitsLeft =
  100.     {
  101.     "DigitsLeft",
  102.     DT_SHORT | PF_fGetData | PF_fSetMsg | PF_fSaveData,
  103.     OFFSETIN(CNTR,DigitsLeft), 0
  104.     };
  105.  
  106. PROPINFO propinfoCntrDigitsRight =
  107.     {
  108.     "DigitsRight",
  109.     DT_SHORT | PF_fGetData | PF_fSetMsg | PF_fSaveData,
  110.     OFFSETIN(CNTR,DigitsRight), 0
  111.     };
  112.  
  113. PROPINFO propinfoCntrForeColorRight =
  114.     {
  115.     "ForeColorRight",
  116.     DT_COLOR | PF_fGetData | PF_fSetData | PF_fSetMsg | PF_fSaveData,
  117.     OFFSETIN(CNTR,colorForeRight), 0
  118.     };
  119.  
  120. PROPINFO propinfoCntrValue =
  121.     {
  122.     "Value",
  123.     DT_REAL | PF_fGetData | PF_fSetMsg | PF_fSaveData,
  124.     OFFSETIN(CNTR,Value), 0
  125.     };
  126.  
  127.  
  128. //---------------------------------------------------------------------------
  129. // Property list
  130. //---------------------------------------------------------------------------
  131. // Define the consecutive indicies for the properties
  132. //---------------------------------------------------------------------------
  133. #define IPROP_CNTR_CTLNAME      0x0000
  134. #define IPROP_CNTR_INDEX      0x0001
  135. #define IPROP_CNTR_BACKCOLOR      0x0002
  136. #define IPROP_CNTR_FORECOLOR      0x0003
  137. #define IPROP_CNTR_LEFT       0x0004
  138. #define IPROP_CNTR_TOP          0x0005
  139. #define IPROP_CNTR_WIDTH      0x0006
  140. #define IPROP_CNTR_HEIGHT      0x0007
  141. #define IPROP_CNTR_VISIBLE      0x0008
  142. #define IPROP_CNTR_FONTNAME      0x0009
  143. #define IPROP_CNTR_FONTSIZE      0x000A
  144. #define IPROP_CNTR_FONTBOLD      0x000B
  145. #define IPROP_CNTR_FONTITALIC      0x000C
  146. #define IPROP_CNTR_FONTSTRIKE      0x000D
  147. #define IPROP_CNTR_FONTUNDER      0x000E
  148. #define IPROP_CNTR_PARENT      0x000F
  149. #define IPROP_CNTR_DRAGMODE      0x0010
  150. #define IPROP_CNTR_DRAGICON      0x0011
  151. #define IPROP_CNTR_TAG          0x0012
  152. #define IPROP_CNTR_VALUE      0x0013
  153. #define IPROP_CNTR_DIGITSLEFT      0x0014
  154. #define IPROP_CNTR_DIGITSRIGHT      0x0015
  155. #define IPROP_CNTR_BACKCOLORRIGHT 0x0016
  156. #define IPROP_CNTR_FORECOLORRIGHT 0x0017
  157. #define IPROP_CNTR_HWND       0x0018
  158.  
  159. PPROPINFO proplistCntr[] =
  160.     {
  161.     PPROPINFO_STD_CTLNAME,
  162.     PPROPINFO_STD_INDEX,
  163.     PPROPINFO_STD_BACKCOLOR,
  164.     PPROPINFO_STD_FORECOLOR,
  165.     PPROPINFO_STD_LEFT,
  166.     PPROPINFO_STD_TOP,
  167.     PPROPINFO_STD_WIDTH,
  168.     PPROPINFO_STD_HEIGHT,
  169.     PPROPINFO_STD_VISIBLE,
  170.     PPROPINFO_STD_FONTNAME,
  171.     PPROPINFO_STD_FONTSIZE,
  172.     PPROPINFO_STD_FONTBOLD,
  173.     PPROPINFO_STD_FONTITALIC,
  174.     PPROPINFO_STD_FONTSTRIKE,
  175.     PPROPINFO_STD_FONTUNDER,
  176.     PPROPINFO_STD_PARENT,
  177.     PPROPINFO_STD_DRAGMODE,
  178.     PPROPINFO_STD_DRAGICON,
  179.     PPROPINFO_STD_TAG,
  180.     &propinfoCntrValue,
  181.     &propinfoCntrDigitsLeft,
  182.     &propinfoCntrDigitsRight,
  183.     &propinfoCntrBackColorRight,
  184.     &propinfoCntrForeColorRight,
  185.     PPROPINFO_STD_HWND,
  186.     NULL
  187.     };
  188.  
  189.  
  190. //---------------------------------------------------------------------------
  191. // Event list
  192. //---------------------------------------------------------------------------
  193. // Define the consecutive indicies for the events
  194. //---------------------------------------------------------------------------
  195. #define IEVENT_CNTR_DRAGDROP    0
  196. #define IEVENT_CNTR_DRAGOVER    1
  197.  
  198. PEVENTINFO eventlistCntr[] =
  199.     {
  200.     PEVENTINFO_STD_DRAGDROP,
  201.     PEVENTINFO_STD_DRAGOVER,
  202.     NULL
  203.     };
  204.  
  205.  
  206. //---------------------------------------------------------------------------
  207. // Model struct
  208. //---------------------------------------------------------------------------
  209. // Define the control model (using the event and property structures).
  210. //---------------------------------------------------------------------------
  211. MODEL modelCntr =
  212.     {
  213.     VB_VERSION,             // VB version being used
  214.     0,                    // MODEL flags
  215.     (PCTLPROC)CntrCtlProc,        // Control procedure
  216.     CS_VREDRAW | CS_HREDRAW,        // Class style
  217.     WS_BORDER,                // Default Window style
  218.     sizeof(CNTR),            // Size of CNTR structure
  219.     IDBMP_CNTR,             // Palette bitmap ID
  220.     "Counter",                // Default control name
  221.     "Counter",                // Visual Basic class name
  222.     NULL,                // Parent class name
  223.     proplistCntr,            // Properties list
  224.     eventlistCntr,            // Events list
  225.     IPROP_CNTR_VALUE,            // Default property
  226.     IEVENT_CNTR_DRAGDROP,        // Default event
  227.     IPROP_CNTR_VALUE            // Property representing value of ctl
  228.     };
  229.  
  230. LPMODEL modellistCntr[] =
  231.     {
  232.     &modelCntr,
  233.     NULL
  234.     };
  235.  
  236. MODELINFO modelinfoCntr =
  237.     {
  238.     VB_VERSION,             // VB version being used
  239.     modellistCntr            // MODEL list
  240.     };
  241.  
  242. #endif  // RC_INVOKED
  243.  
  244. //---------------------------------------------------------------------------
  245.