home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Programmer'…arterly (Limited Edition) / Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso / code / ch21code / long.cls < prev    next >
Text File  |  1995-08-14  |  1KB  |  51 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "clsLong"
  6. Attribute VB_Creatable = True
  7. Attribute VB_Exposed = True
  8. ' Long class -- LONG.CLS
  9. '   Parses Long integers into integers (words)
  10. '
  11. '   Properties
  12. '       Value
  13. '
  14. '   Methods
  15. '       LoWord
  16. '       HiWord
  17. '
  18. Option Explicit
  19.  
  20. ' Value property (read/write)
  21. Public Value
  22.  
  23. Public Function HiWord() As Object
  24.     ' Create a new object to return.
  25.     Dim intReturn As New clsInteger
  26.     ' Get the high word and set the inReturn object's
  27.     ' Value property.
  28.     If Me.Value > &H7FFFFFFF Then
  29.         intReturn.Value = (Me.Value And &HFFFF0000) \ &H10000
  30.     Else
  31.         intReturn.Value = ((Me.Value And &HFFFF0000) / &H10000) Xor &HFFFF0000
  32.     End If
  33.     ' Return the intReturn object as the result.
  34.     ' Note that you must use Set, since this is object
  35.     ' assignment.
  36.     Set HiWord = intReturn
  37. End Function
  38.  
  39. Public Function LoWord() As Object
  40.     ' Create a new object to return.
  41.     Dim intReturn As New clsInteger
  42.     ' Get the low word and set the inReturn object's
  43.     ' Value property.
  44.     intReturn.Value = Me.Value And (Me.Value Xor &HFFFF0000)
  45.     ' Return the intReturn object as the result.
  46.     ' Note that you must use Set, since this is object
  47.     ' assignment.
  48.     Set LoWord = intReturn
  49. End Function
  50.  
  51.