home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l391_1 / 4.ddi / CUSTEVNT.C$ / CUSTEVNT.bin
Encoding:
Text File  |  1992-08-19  |  10.7 KB  |  168 lines

  1. /* ----------------------------------------------------------------------------
  2.  * CUSTEVNT.C: Custom Control Event Procedures
  3.  *
  4.  * Custom control event procedure templates created by
  5.  * CUSTGEN.EXE (Custom Control Template Generator).
  6.  *
  7.  * CUSTGEN.EXE is a utility provided to make custom
  8.  * control development easier.  It allows you to select
  9.  * the events you want your custom control to respond to,
  10.  * then generates code templates and a custom control
  11.  * registration routine for these events.
  12.  *
  13.  * Modify the code template file as necessary, then build
  14.  * your custom control as follows:
  15.  *    ML -c <RegisterFile>          ; Assumes Masm 6.0 compiler
  16.  *    CL -c <TemplateFile>
  17.  *    DEL <TemplateFile.LIB>        ; Delete existing library if exists
  18.  *    LIB <TemplateFile.LIB>+<RegisterFile.OBJ>+<TemplateFile.OBJ>
  19.  *    LINK /Q <TemplateFile.LIB>,<TemplateFile.QLB>,,VBDOSQLB.LIB;
  20.  * You can combine multiple custom controls into one Quick library for
  21.  * use within the programming environment as follows:
  22.  *    DEL <CombinedLib.LIB>         ; Delete existing library if exists
  23.  *    LIB <CombinedLib.LIB>+<Cust1.LIB>+<Cust2.LIB>+<CustN.LIB>
  24.  *    LINK /Q <CombinedLib.LIB>,<CombinedLib.QLB>,,VBDOSQLB.LIB;
  25.  * To create an Alternate Math custom control library (instead of an
  26.  * Emulator Math custom control library as shown above), compile the 
  27.  * TemplateFile with the /FPa switch.  Note, an Altmath library cannot be
  28.  * used to create a Quick Library.
  29.  *
  30.  *
  31.  * Copyright (C) 1982-1992 Microsoft Corporation
  32.  *
  33.  * You have a royalty-free right to use, modify, reproduce
  34.  * and distribute the sample applications and toolkits provided with
  35.  * Visual Basic for MS-DOS (and/or any modified version)
  36.  * in any way you find useful, provided that you agree that
  37.  * Microsoft has no warranty, obligations or liability for
  38.  * any of the sample applications or toolkits.
  39.  * -------------------------------------------------------------------------- */
  40.  
  41.  
  42. /* Include file containing constant definitions for
  43.  * Property, Event, Method and ControlType ID numbers. */
  44. #include "custincl.h"
  45.  
  46. /* Declarations for custom control callbacks.
  47.  * These callbacks are used to set and get custom control
  48.  * properties and invoke custom control methods and events.
  49.  *
  50.  *    AID = Attribute Id - list is found in CUSTINCL include file.
  51.  *    CID = Control Id created internally by Visual Basic
  52.  *    EID = Event Id - list is found in CUSTINCL include file.
  53.  *    MthID = Method Id - list is found in CUSTINCL include file.
  54.  *    PID = Property Id - list is found in CUSTINCL include file.
  55.  *
  56.  * Declare callbacks for invoking methods and events and getting
  57.  * and setting properties.  These callbacks accept a variable number 
  58.  * and types of arguments depending on the method or event that is 
  59.  * being invoked. */
  60. extern void _far _pascal InvokeEvent();
  61. extern void _far _pascal InvokeMethod();
  62. extern void _far _pascal GetProperty();
  63. extern void _far _pascal SetProperty();
  64.  
  65. /* Declare callback for getting a control's container object.
  66.  * This callback returns a ControlID for the container object. */
  67. extern int _far _pascal GetContainer (unsigned int CID);
  68.  
  69. /* Declare callback for setting a control's attributes (access key,
  70.  * focus availability, arrow key trapping ability, and text cursor 
  71.  * location).  Refer to the custom control section of the README.TXT
  72.  * file for complete information on using this callback. */
  73. extern void _far _pascal SetAttribute (unsigned int CID, unsigned int AID, unsigned int Value);
  74.  
  75. /* Declare unique callbacks for each property datatype for 
  76.  * setting and getting property values by aliasing the
  77.  * GetProperty and SetProperty callbacks which accept any datatype.
  78.  * This provides type checking during calls to these procedures. */
  79. #define GetIntProperty(Value, CID, PID)     GetProperty ((int *) Value, (unsigned int) CID, (unsigned int) PID)
  80. #define GetStringProperty(Value, CID, PID)  GetProperty ((char *) Value, (unsigned int) CID, (unsigned int) PID)
  81. #define GetLongProperty(Value, CID, PID)    GetProperty ((long *) Value, (unsigned int) CID, (unsigned int) PID)
  82. #define SetIntProperty(Value, CID, PID)     SetProperty ((int) Value, (unsigned int) CID, (unsigned int) PID)
  83. #define SetStringProperty(Value, CID, PID)  SetProperty ((char *) Value, (unsigned int) CID, (unsigned int) PID)
  84. #define SetLongProperty(Value, CID, PID)    SetProperty ((long) Value, (unsigned int) CID, (unsigned int) PID)
  85.  
  86. /* Declare unique callbacks for invoking each user event
  87.  * by aliasing the InvokeEvent callback which accepts a variable number
  88.  * of arguments and types depending on the event being invoked.
  89.  * This provides type checking during calls to these procedures. */
  90. #define InvokeChangeEvent(CID, EventID)                     InvokeEvent ((unsigned int) CID, (unsigned int) EventID)
  91. #define InvokeClickEvent(CID,  EventID)                     InvokeEvent ((unsigned int) CID, (unsigned int) EventID)
  92. #define InvokeCustomEvent(EventType, CID, EventID)          InvokeEvent ((int *) EventType, (unsigned int) CID, (unsigned int) EventID)
  93. #define InvokeDblClickEvent(CID, EventID)                   InvokeEvent ((unsigned int) CID, (unsigned int) EventID)
  94. #define InvokeDragDropEvent(SourceCID, X, Y, CID, EventID)  InvokeEvent ((unsigned int) SourceCID, (float *) X, (float *) Y, (unsigned int) CID, (unsigned int) EventID)
  95. #define InvokeDragOverEvent(SourceCID, X, Y, CID, EventID)  InvokeEvent ((unsigned int) SourceCID, (float *) X, (float *) Y, (unsigned int) CID, (unsigned int) EventID)
  96. #define InvokeDropDownEvent(CID, EventID)                   InvokeEvent ((unsigned int) CID, (unsigned int) EventID)
  97. #define InvokeGotFocusEvent(CID, EventID)                   InvokeEvent ((unsigned int) CID, (unsigned int) EventID)
  98. #define InvokeKeyDownEvent (KeyCode, Shift, CID, EventID)   InvokeEvent ((int *) KeyCode, (int *) Shift, (unsigned int) CID, (unsigned int) EventID)
  99. #define InvokeKeyPressEvent(KeyCode, CID, EventID)          InvokeEvent ((int *) KeyCode, (unsigned int) CID, (unsigned int) EventID)
  100. #define InvokeKeyUpEvent(KeyCode, Shift, CID, EventID)      InvokeEvent ((int *) KeyCode, (int *) Shift, (unsigned int) CID, (unsigned int) EventID)
  101. #define InvokeLoadEvent(CID, EventID)                       InvokeEvent ((unsigned int) CID, (unsigned int) EventID)
  102. #define InvokeLostFocusEvent(CID, EventID)                  InvokeEvent ((unsigned int) CID, (unsigned int) EventID)
  103. #define InvokeMouseDownEvent(Button, Shift, X, Y, CID, EventID)    InvokeEvent ((int *) Button, (int *) Shift, (float *) X, (float *) Y, (unsigned int) CID, (unsigned int) EventID)
  104. #define InvokeMouseMoveEvent(Button, Shift, X, Y, CID, EventID)    InvokeEvent ((int *) Button, (int *) Shift, (float *) X, (float *) Y, (unsigned int) CID, (unsigned int) EventID)
  105. #define InvokeMouseUpEvent(Button, Shift, X, Y, CID, EventID)      InvokeEvent ((int *) Button, (int *) Shift, (float *) X, (float *) Y, (unsigned int) CID, (unsigned int) EventID)
  106. #define InvokePaintEvent(CID, EventID)                      InvokeEvent ((unsigned int) CID, (unsigned int) EventID)
  107. #define InvokePathChangeEvent(CID, EventID)                 InvokeEvent ((unsigned int) CID, (unsigned int) EventID)
  108. #define InvokePatternChangeEvent(CID, EventID)              InvokeEvent ((unsigned int) CID, (unsigned int) EventID)
  109. #define InvokeResizeEvent(CID, EventID)                     InvokeEvent ((unsigned int) CID, (unsigned int) EventID)
  110. #define InvokeTimerEvent(CID, EventID)                      InvokeEvent ((unsigned int) CID, (unsigned int) EventID)
  111. #define InvokeUnloadEvent(Cancel, CID, EventID)             InvokeEvent (int *) Cancel, (unsigned int) CID, (unsigned int) EventID)
  112.  
  113. /* Declare unique callbacks for invoking each custom control method
  114.  * by aliasing the InvokeMethod callback which accepts a variable number
  115.  * of arguments and types depending on the method being invoked.
  116.  * This provides type checking during calls to these procedures. */
  117. #define InvokePrintFormMethod(NumArgs, CID, MthID)          InvokeMethod ((unsigned int) NumArgs, (unsigned int) CID, (unsigned int) MthID);
  118. #define InvokeCLSMethod(NumArgs, CID, MthID)                InvokeMethod ((unsigned int) NumArgs, (unsigned int) CID, (unsigned int) MthID);
  119. #define InvokeHideMethod(NumArgs, CID, MthID)               InvokeMethod ((unsigned int) NumArgs, (unsigned int) CID, (unsigned int) MthID);
  120. #define InvokeShowMethod(Modal, NumArgs, CID, MthID)        InvokeMethod ((int) Modal, (signed int) NumArgs, (unsigned int) CID, (unsigned int) MthID);
  121. #define InvokeRefreshMethod(NumArgs, CID, MthID)            InvokeMethod ((unsigned int) NumArgs, (unsigned int) CID, (unsigned int) MthID);
  122. #define InvokeMoveMethod(Left, Top, Width, Height, NumArgs, CID, MthID)    InvokeMethod ((int) Left, (int) Top, (int) Width, (int) Height, (unsigned int) NumArgs, (unsigned int) CID, (unsigned int) MthID);
  123. #define InvokeSetFocusMethod(NumArgs, CID, MthID)           InvokeMethod ((int) NumArgs, (unsigned int) CID, (unsigned int) MthID);
  124. #define InvokeDragMethod(Action, NumArgs, CID, MthID)       InvokeMethod ((int) Action, (unsigned int) NumArgs, (unsigned int) CID, (unsigned int) MthID);
  125.  
  126.  
  127. int _far _pascal MyControl_CClick(void _near * Control, unsigned int ControlID)
  128. {
  129.  
  130. /* Place your comments and code for this event here.
  131.  * Basic errors are triggered by returning a non-zero value (ERR).
  132.  * Set and get properties and invoke methods and user events and 
  133.  * by using the appropriate callbacks declared above.
  134.  * PropertyID, EventID, and MethodID constant definitions are
  135.  * are contained in the CUSTINCL include file. */
  136.  
  137. /* IMPORTANT: You must always have a return value. */
  138.     return (0);
  139.  
  140. int _far _pascal MyControl_CKeyPress(void _near * Control, unsigned int ControlID, int * KeyAscii)
  141. {
  142.  
  143. /* Place your comments and code for this event here.
  144.  * Basic errors are triggered by returning a non-zero value (ERR).
  145.  * Set and get properties and invoke methods and user events and 
  146.  * by using the appropriate callbacks declared above.
  147.  * PropertyID, EventID, and MethodID constant definitions are
  148.  * are contained in the CUSTINCL include file. */
  149.  
  150. /* IMPORTANT: You must always have a return value. */
  151.     return (0);
  152.  
  153. int _far _pascal MyControl_CIntegerGet(void _near * Control, unsigned int ControlID, int PropertyID, int * Value)
  154. {
  155.  
  156. /* Place your comments and code for this event here.
  157.  * Basic errors are triggered by returning a non-zero value (ERR).
  158.  * Set and get properties and invoke methods and user events and 
  159.  * by using the appropriate callbacks declared above.
  160.  * PropertyID, EventID, and MethodID constant definitions are
  161.  * are contained in the CUSTINCL include file. */
  162.  
  163. /* IMPORTANT: You must always have a return value. */
  164.     return (0);
  165.