home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / oleaut / dspcalc2 / readme.txt < prev    next >
Encoding:
Text File  |  1996-01-17  |  3.0 KB  |  81 lines

  1. OLE Automation Sample
  2.  
  3.  
  4. SUMMARY
  5. =======
  6.  
  7. The DspCalc2 sample is a simple accumulator-based calculator. Its user
  8. interface consists of buttons for the numbers (0-9), the operators 
  9. (+, -, *, /), and some other necessary buttons (C for Clear, = for 
  10. evaluation). Its programmability interface consists of one object, which is 
  11. described below.
  12.  
  13. The ProgID for DspCalc2's only object is "DspCalc2.Application". An instance
  14. of this object can be created by executing the following lines of code in 
  15. Visual Basic or DispTest:
  16.  
  17.     Sub Foo
  18.         Dim MyCalculator as Object    
  19.         Set MyCalculator = CreateObject("DspCalc2.Application")
  20.         . . .
  21.     End Sub
  22.  
  23. MORE INFORMATION
  24. ================
  25.  
  26. Program Structure
  27. -----------------
  28.  
  29. DspCalc2 uses a type library and CreateStdDispatch to implement the
  30. IDispatch interface.
  31.  
  32. Properties for the Object
  33. -------------------------
  34.  
  35. Name     Type     Description
  36.  
  37. Value    VT_I4    Same as the value for the accumulator.
  38. Accum    VT_I4    The value that is in the accumulator of the calculator.
  39. Opnd     VT_I4    The operand. This is the number currently being entered.
  40. Op       VT_I2    The operator that is currently being used. This is an 
  41.                   enumeration:
  42.                       const OP_NONE = 0
  43.                       const OP_PLUS = 1 
  44.                       const OP_MINUS = 2
  45.                       const OP_MULT = 3
  46.  
  47. Methods Defined on the Object
  48. -----------------------------
  49.  
  50. Name                               Description
  51.  
  52. Eval as Boolean                    If there is an operator, apply it to the
  53.                                    accumulator and the operand, placing the
  54.                                    result in the accumulator. The return 
  55.                                    value indicates success or failure.
  56. Clear                              Resets the calculator. This sets Op to
  57.                                    OP_NONE, and both Accum and Opnd to 0.
  58. Display                            Updates the display of the calculator.
  59.                                    (Other operations do not do this.)
  60. Quit                               Close the calculator.
  61. Button (b as string) as Boolean    Press the indicated button and return
  62.                                    success or failure. Valid string values 
  63.                                    are:
  64.                                        +, -, *, +
  65.                                        0-9
  66.                                        c, C
  67.                                        =
  68.  
  69.                                    Note that you may also pass the numbers 
  70.                                    0-9 and these will be converted to 
  71.                                    strings automatically.
  72.  
  73. Shortcomings of this Sample
  74. ---------------------------
  75.  
  76. Property and method names should not be abbreviated. For example, the "Opnd" 
  77. property should be the "Operand" property.
  78.  
  79. Because the object is the application object, it should have Name and 
  80. Version properties, which are read-only.
  81.