home *** CD-ROM | disk | FTP | other *** search
/ On Hand / On_Hand_From_Softbank_1994_Release_2_Disc_2_1994.iso / 00202 / s / disk1 / cntr.h_ / cntr.bin
Text File  |  1993-04-28  |  8KB  |  250 lines

  1. //---------------------------------------------------------------------------
  2. //        Copyright (C) 1991-93, 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-93\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            3,00,0,00
  39. #define VBX_VERSION_STR        "3.00.000\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),
  97.     0, 0, NULL, 0
  98.     };
  99.  
  100. PROPINFO propinfoCntrDigitsLeft =
  101.     {
  102.     "DigitsLeft",
  103.     DT_SHORT | PF_fGetData | PF_fSetMsg | PF_fSaveData,
  104.     OFFSETIN(CNTR,DigitsLeft),
  105.     0, 0, NULL, 0
  106.     };
  107.  
  108. PROPINFO propinfoCntrDigitsRight =
  109.     {
  110.     "DigitsRight",
  111.     DT_SHORT | PF_fGetData | PF_fSetMsg | PF_fSaveData,
  112.     OFFSETIN(CNTR,DigitsRight),
  113.     0, 0, NULL, 0
  114.     };
  115.  
  116. PROPINFO propinfoCntrForeColorRight =
  117.     {
  118.     "ForeColorRight",
  119.     DT_COLOR | PF_fGetData | PF_fSetData | PF_fSetMsg | PF_fSaveData,
  120.     OFFSETIN(CNTR,colorForeRight),
  121.     0, 0, NULL, 0
  122.     };
  123.  
  124. PROPINFO propinfoCntrValue =
  125.     {
  126.     "Value",
  127.     DT_REAL | PF_fGetData | PF_fSetMsg | PF_fSaveData,
  128.     OFFSETIN(CNTR,Value),
  129.     0, 0, NULL, 0
  130.     };
  131.  
  132.  
  133. //---------------------------------------------------------------------------
  134. // Property list
  135. //---------------------------------------------------------------------------
  136. // Define the consecutive indicies for the properties
  137. //---------------------------------------------------------------------------
  138. #define IPROP_CNTR_CTLNAME      0x0000
  139. #define IPROP_CNTR_INDEX      0x0001
  140. #define IPROP_CNTR_BACKCOLOR      0x0002
  141. #define IPROP_CNTR_FORECOLOR      0x0003
  142. #define IPROP_CNTR_LEFT       0x0004
  143. #define IPROP_CNTR_TOP          0x0005
  144. #define IPROP_CNTR_WIDTH      0x0006
  145. #define IPROP_CNTR_HEIGHT      0x0007
  146. #define IPROP_CNTR_VISIBLE      0x0008
  147. #define IPROP_CNTR_FONTNAME      0x0009
  148. #define IPROP_CNTR_FONTSIZE      0x000A
  149. #define IPROP_CNTR_FONTBOLD      0x000B
  150. #define IPROP_CNTR_FONTITALIC      0x000C
  151. #define IPROP_CNTR_FONTSTRIKE      0x000D
  152. #define IPROP_CNTR_FONTUNDER      0x000E
  153. #define IPROP_CNTR_PARENT      0x000F
  154. #define IPROP_CNTR_DRAGMODE      0x0010
  155. #define IPROP_CNTR_DRAGICON      0x0011
  156. #define IPROP_CNTR_TAG          0x0012
  157. #define IPROP_CNTR_VALUE      0x0013
  158. #define IPROP_CNTR_DIGITSLEFT      0x0014
  159. #define IPROP_CNTR_DIGITSRIGHT      0x0015
  160. #define IPROP_CNTR_BACKCOLORRIGHT 0x0016
  161. #define IPROP_CNTR_FORECOLORRIGHT 0x0017
  162. #define IPROP_CNTR_HWND       0x0018
  163.  
  164. PPROPINFO proplistCntr[] =
  165.     {
  166.     PPROPINFO_STD_CTLNAME,
  167.     PPROPINFO_STD_INDEX,
  168.     PPROPINFO_STD_BACKCOLOR,
  169.     PPROPINFO_STD_FORECOLOR,
  170.     PPROPINFO_STD_LEFT,
  171.     PPROPINFO_STD_TOP,
  172.     PPROPINFO_STD_WIDTH,
  173.     PPROPINFO_STD_HEIGHT,
  174.     PPROPINFO_STD_VISIBLE,
  175.     PPROPINFO_STD_FONTNAME,
  176.     PPROPINFO_STD_FONTSIZE,
  177.     PPROPINFO_STD_FONTBOLD,
  178.     PPROPINFO_STD_FONTITALIC,
  179.     PPROPINFO_STD_FONTSTRIKE,
  180.     PPROPINFO_STD_FONTUNDER,
  181.     PPROPINFO_STD_PARENT,
  182.     PPROPINFO_STD_DRAGMODE,
  183.     PPROPINFO_STD_DRAGICON,
  184.     PPROPINFO_STD_TAG,
  185.     &propinfoCntrValue,
  186.     &propinfoCntrDigitsLeft,
  187.     &propinfoCntrDigitsRight,
  188.     &propinfoCntrBackColorRight,
  189.     &propinfoCntrForeColorRight,
  190.     PPROPINFO_STD_HWND,
  191.     NULL
  192.     };
  193.  
  194.  
  195. //---------------------------------------------------------------------------
  196. // Event list
  197. //---------------------------------------------------------------------------
  198. // Define the consecutive indicies for the events
  199. //---------------------------------------------------------------------------
  200. #define IEVENT_CNTR_DRAGDROP    0
  201. #define IEVENT_CNTR_DRAGOVER    1
  202.  
  203. PEVENTINFO eventlistCntr[] =
  204.     {
  205.     PEVENTINFO_STD_DRAGDROP,
  206.     PEVENTINFO_STD_DRAGOVER,
  207.     NULL
  208.     };
  209.  
  210.  
  211. //---------------------------------------------------------------------------
  212. // Model struct
  213. //---------------------------------------------------------------------------
  214. // Define the control model (using the event and property structures).
  215. //---------------------------------------------------------------------------
  216. MODEL modelCntr =
  217.     {
  218.     VB_VERSION,             // VB version being used
  219.     0,                    // MODEL flags
  220.     (PCTLPROC)CntrCtlProc,        // Control procedure
  221.     CS_VREDRAW | CS_HREDRAW,        // Class style
  222.     WS_BORDER,                // Default Window style
  223.     sizeof(CNTR),            // Size of CNTR structure
  224.     IDBMP_CNTR,             // Palette bitmap ID
  225.     "Counter",                // Default control name
  226.     "Counter",                // Visual Basic class name
  227.     NULL,                // Parent class name
  228.     proplistCntr,            // Properties list
  229.     eventlistCntr,            // Events list
  230.     IPROP_CNTR_VALUE,            // Default property
  231.     IEVENT_CNTR_DRAGDROP,        // Default event
  232.     IPROP_CNTR_VALUE            // Property representing value of ctl
  233.     };
  234.  
  235. LPMODEL modellistCntr[] =
  236.     {
  237.     &modelCntr,
  238.     NULL
  239.     };
  240.  
  241. MODELINFO modelinfoCntr =
  242.     {
  243.     VB_VERSION,             // VB version being used
  244.     modellistCntr            // MODEL list
  245.     };
  246.  
  247. #endif  // RC_INVOKED
  248.  
  249. //---------------------------------------------------------------------------
  250.