home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 8 / Power CD-ROM 8.iso / prgmming / skelet / skeldat.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-15  |  11.2 KB  |  334 lines

  1.  
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Filename:     skeldat.cpp
  5. //
  6. // Description:  Skeleton Visual Basic Custom Control.
  7. //
  8. //               Control global data.
  9. //
  10. // Date Created: <Date>
  11. //
  12. // Author:       <Your Name>
  13. //
  14. // Copyright (c) <Your Company Name> 1994
  15. //
  16. //               Portions of this product are based on original
  17. //                  source code from Anton Software Limited.
  18. //
  19. //////////////////////////////////////////////////////////////////////////////
  20.  
  21. #include <windows.h>
  22. #include <vbapi.h>
  23.  
  24. #include "skeleton.hpp"
  25. #include "skelexp.hpp"
  26. #include "skelext.hpp"
  27.  
  28. //////////////////////////////////////////////////////////////////////////////
  29. //
  30. // DLL (VBX) module handle
  31. //
  32. //////////////////////////////////////////////////////////////////////////////
  33. HANDLE hmodDLL = (HANDLE)NULL;
  34.  
  35. //////////////////////////////////////////////////////////////////////////////
  36. //
  37. // Message Box title
  38. //
  39. //////////////////////////////////////////////////////////////////////////////
  40. LPSTR lpstrMsgBoxTitle = "Skeleton Custom Control";
  41.  
  42. //////////////////////////////////////////////////////////////////////////////
  43. //
  44. // About box parent window's class name
  45. //
  46. //////////////////////////////////////////////////////////////////////////////
  47. LPSTR lpstrAboutBoxParent = "SkeletonAboutParent";
  48.  
  49. //////////////////////////////////////////////////////////////////////////////
  50. //
  51. // Property information
  52. //
  53. //////////////////////////////////////////////////////////////////////////////
  54.  
  55. static PROPINFO NEAR propinfoAbout =
  56. {
  57.     "(About)",              // property name
  58.                             // property flags:
  59.     DT_ENUM        |        //   ENUM - about box popup
  60.     PF_fNoRuntimeR |        //   data cannot be read at run-time
  61.     PF_fNoRuntimeW,         //   data cannot be changed at run-time
  62.  
  63.     OFFSETIN(SKELETON,
  64.              enumAbout),    // offset in SKELETON structure
  65.     0,                      // infodata - for packing (not used)
  66.     0,                      // default value (not used)
  67.     "Click on \"...\""
  68.     " for About Box\0",     // property box string
  69.     0                       // maximum value (not used)
  70.  
  71. }; // propinfoAbout
  72.  
  73. // TO DO: Use propinfoMyProp1 as a template for your custom HSZ properties.
  74.  
  75. static PROPINFO NEAR propinfoMyProp1 =
  76. {
  77.     "MyProp1",              // property name
  78.                             // property flags:
  79.     DT_HSZ       |          //   property type (string)
  80.     PF_fGetData  |          //   VB gets value directly
  81.     PF_fSaveData |          //   VB saves value to disk directly
  82.     PF_fSetData  |          //   VB sets value directly
  83.     PF_fSetCheck |          //   VB sends a message before setting value
  84.     PF_fSetMsg,             //   VB sends msg when setting prop. is attempted
  85.  
  86.     OFFSETIN(SKELETON,
  87.              hszMyProp1),   // offset in control structure
  88.     0,                      // infodata - for packing (not used)
  89.     0,                      // default value (not used)
  90.     NULL,                   // property box strings (not used)
  91.     0                       // maximum value (not used)
  92.  
  93. }; // propinfoMyProp1
  94.  
  95. // TO DO: Use propinfoMyProp2 as a template for your other custom properties.
  96.  
  97. static PROPINFO NEAR propinfoMyProp2 =
  98. {
  99.     "MyProp2",              // property name
  100.                             // property flags:
  101.     DT_ENUM      |          //   property type (enumerated integer)
  102.     PF_fGetData  |          //   VB gets value directly
  103.     PF_fGetMsg   |          //   VB sends msg when getting prop. is attempted
  104.     PF_fSaveData |          //   VB saves value to disk directly
  105.     PF_fSetData  |          //   VB sets value directly
  106.     PF_fSetMsg,             //   VB sends msg when setting prop. is attempted
  107.  
  108.     OFFSETIN(SKELETON,
  109.              enumMyProp2),  // offset in control structure
  110.     0,                      // infodata - for packing (not used)
  111.     0,                      // default value
  112.  
  113.       "0 - First Value\0"   // property box strings
  114.       "1 - Second Value\0"
  115.       "2 - Third Value\0"
  116.  
  117.     "",
  118.     0                       // maximum value (not used)
  119.  
  120. }; // propinfoMyProp2
  121.  
  122. //////////////////////////////////////////////////////////////////////////////
  123. //
  124. // Property list
  125. //
  126. //////////////////////////////////////////////////////////////////////////////
  127.  
  128. static PPROPINFO NEAR proplistSkeleton[] =
  129. {
  130.     // TO DO: choose the standard properties you want your control to have,
  131.     //        and delete the unwanted properties from the list below. (You
  132.     //        will have to make a similar change in the skeleton.hpp file.)
  133.  
  134.     // Standard properties.
  135.     PPROPINFO_STD_NAME,
  136.     PPROPINFO_STD_INDEX,
  137.     PPROPINFO_STD_ALIGN,
  138.     PPROPINFO_STD_BACKCOLOR,
  139.     PPROPINFO_STD_BORDERSTYLEON,
  140.     PPROPINFO_STD_CLIPCONTROLS,
  141.     PPROPINFO_STD_DATACHANGED,
  142.     PPROPINFO_STD_DATAFIELD,
  143.     PPROPINFO_STD_DATASOURCE,
  144.     PPROPINFO_STD_DRAGICON,
  145.     PPROPINFO_STD_DRAGMODE,
  146.     PPROPINFO_STD_ENABLED,
  147.     PPROPINFO_STD_FONTBOLD,
  148.     PPROPINFO_STD_FONTITALIC,
  149.     PPROPINFO_STD_FONTNAME,
  150.     PPROPINFO_STD_FONTSIZE,
  151.     PPROPINFO_STD_FONTSTRIKE,
  152.     PPROPINFO_STD_FONTUNDER,
  153.     PPROPINFO_STD_FORECOLOR,
  154.     PPROPINFO_STD_HEIGHT,
  155.     PPROPINFO_STD_HELPCONTEXTID,
  156.     PPROPINFO_STD_HWND,
  157.     PPROPINFO_STD_LEFT,
  158.     PPROPINFO_STD_LINKITEM,
  159.     PPROPINFO_STD_LINKMODE,
  160.     PPROPINFO_STD_LINKTIMEOUT,
  161.     PPROPINFO_STD_LINKTOPIC,
  162.     PPROPINFO_STD_MOUSEPOINTER,
  163.     PPROPINFO_STD_PARENT,
  164.     PPROPINFO_STD_TABINDEX,
  165.     PPROPINFO_STD_TABSTOP,
  166.     PPROPINFO_STD_TAG,
  167.     PPROPINFO_STD_TEXT,
  168.     PPROPINFO_STD_TOP,
  169.     PPROPINFO_STD_VISIBLE,
  170.     PPROPINFO_STD_WIDTH,
  171.  
  172.     // TO DO: choose the custom properties you want your control to have. Use
  173.     //        MyProp1 and MyProp2 as templates for these new properties. (You
  174.     //        will have to make a similar change in the skeleton.hpp file.)
  175.  
  176.     // Custom properties.
  177.     &propinfoAbout,
  178.     &propinfoMyProp1,
  179.     &propinfoMyProp2,
  180.     NULL
  181.  
  182. }; // proplistSkeleton
  183.  
  184. //////////////////////////////////////////////////////////////////////////////
  185. //
  186. // Event information
  187. //
  188. //////////////////////////////////////////////////////////////////////////////
  189.  
  190. // TO DO: Use ParamTypesMyEvent as a template for the event parameter
  191. //        structures of your custom events.
  192.  
  193. static WORD NEAR ParamTypesMyEvent[] =
  194. {
  195.     ET_I4, // Param1
  196.     ET_I2  // Param2
  197.  
  198. }; // ParamTypesMyEvent
  199.  
  200. // TO DO: Use eventinfoMyEvent as a template for your custom events.
  201.  
  202. static EVENTINFO NEAR eventinfoMyEvent =
  203. {
  204.     "MyEvent",                  // event name
  205.     2,                          // number of arguments
  206.     4,                          // number of words in argument list
  207.     ParamTypesMyEvent,          // argument type array
  208.  
  209.       "Param1 As Long, "        // argument string
  210.       "Param2 As Integer"
  211.  
  212. }; // eventinfoMyEvent
  213.  
  214. //////////////////////////////////////////////////////////////////////////////
  215. //
  216. // Event list
  217. //
  218. //////////////////////////////////////////////////////////////////////////////
  219.  
  220. static PEVENTINFO NEAR eventlistSkeleton[] =
  221. {
  222.     // TO DO: choose the standard events you want your control to have, and
  223.     //        delete the unwanted events from the list below. (You will have
  224.     //        to make a similar change in the skeleton.hpp file.)
  225.  
  226.     // Standard events.
  227.     PEVENTINFO_STD_CLICK,
  228.     PEVENTINFO_STD_DBLCLICK,
  229.     PEVENTINFO_STD_DRAGDROP,
  230.     PEVENTINFO_STD_DRAGOVER,
  231.     PEVENTINFO_STD_GOTFOCUS,
  232.     PEVENTINFO_STD_KEYDOWN,
  233.     PEVENTINFO_STD_KEYPRESS,
  234.     PEVENTINFO_STD_KEYUP,
  235.     PEVENTINFO_STD_LOSTFOCUS,
  236.     PEVENTINFO_STD_MOUSEDOWN,
  237.     PEVENTINFO_STD_MOUSEMOVE,
  238.     PEVENTINFO_STD_MOUSEUP,
  239.     PEVENTINFO_STD_LINKERROR,
  240.     PEVENTINFO_STD_LINKOPEN,
  241.     PEVENTINFO_STD_LINKCLOSE,
  242.     PEVENTINFO_STD_LINKNOTIFY,
  243.     PEVENTINFO_STD_LINKCHANGE,
  244.  
  245.     // TO DO: choose the custom events you want your control to have. Use
  246.     //        MyEvent as a template for these new events. (You will have
  247.     //        to make a similar change in the skeleton.hpp file.)
  248.  
  249.     // Custom events.
  250.     &eventinfoMyEvent,
  251.     NULL
  252.  
  253. }; // eventlistSkeleton
  254.  
  255. //////////////////////////////////////////////////////////////////////////////
  256. //
  257. // Model list
  258. //
  259. //////////////////////////////////////////////////////////////////////////////
  260.  
  261. static LPMODEL NEAR modellistSkeleton[] =
  262. {
  263.     &modelSkeleton,
  264.     NULL
  265. };
  266.  
  267. //////////////////////////////////////////////////////////////////////////////
  268. //
  269. // Model information
  270. //
  271. //////////////////////////////////////////////////////////////////////////////
  272.  
  273. MODELINFO NEAR modelinfoSkeleton =
  274. {
  275.     VB200_VERSION,          // Visual Basic version being used (minimum)
  276.     modellistSkeleton       // MODEL list
  277. };
  278.  
  279. //////////////////////////////////////////////////////////////////////////////
  280. //
  281. // Model structure
  282. //
  283. //////////////////////////////////////////////////////////////////////////////
  284.  
  285. MODEL NEAR modelSkeleton =
  286. {
  287.     VB200_VERSION,              // Visual Basic version (minimum)
  288.  
  289.                                 // MODEL flags:
  290.  
  291.     // TO DO: choose the model flags appropriate for your control from the
  292.     //        list below. Do not remove the fLoadMsg and fInitMsg flags.
  293.  
  294. /*    MODEL_fArrows      |      //   gets messages for arrow keys     */
  295. /*    MODEL_fChildrenOk  |      //   may contain child controls       */
  296. /*    MODEL_fDesInteract |      //   gets right mouse button messages */
  297. /*    MODEL_fFocusOk     |      //   can get focus at run time        */
  298. /*    MODEL_fGraphical   |      //   graphical control (no hWnd)      */
  299. /*    MODEL_fInvisAtRun  |      //   only displayed at design time    */
  300. /*    MODEL_fMnemonic    |      //   gets mnemonic messages           */
  301.  
  302.       MODEL_fLoadMsg     |      //   gets created and load messages
  303.       MODEL_fInitMsg,           //   gets initialisation messages
  304.  
  305.     (PCTLPROC)SkeletonCtlProc,  // control procedure
  306.     0,                          // class style (not used)
  307.     0L,                         // default Window style (not used)
  308.     sizeof(SKELETON),           // cbCtlExtra for Skeleton structure
  309.     IDBMP_SKELETON,             // palette bitmap ID
  310.     "Skeleton",                 // default control name
  311.     "Skeleton",                 // Visual Basic class name
  312.  
  313.     // TO DO: choose the parent class name for your control from the list
  314.     //        below. Use NULL if your control is not a subclassed standard
  315.     //        control.
  316.  
  317.     NULL,                       // parent class name (not used)
  318.  
  319. /*  "BUTTON",                   // parent class name */
  320. /*  "COMBOBOX",                 // parent class name */
  321. /*  "EDIT",                     // parent class name */
  322. /*  "LISTBOX",                  // parent class name */
  323. /*  "SCROLLBAR",                // parent class name */
  324. /*  "STATIC",                   // parent class name */
  325.  
  326.     proplistSkeleton,           // properties list
  327.     eventlistSkeleton,          // events list
  328.     IPROP_NAME,                 // default property
  329.     IEVENT_MYEVENT,             // default event
  330.     IPROP_MYPROP1               // property representing value of control
  331.  
  332. }; // modelSkeleton
  333.  
  334.