home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Stream_MP32029381162006.psc / DataQueueItem.cls < prev    next >
Text File  |  2006-11-06  |  2KB  |  65 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "DataQueueItem"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Option Explicit
  15.  
  16. Private Declare Sub CpyMem Lib "kernel32" Alias "RtlMoveMemory" ( _
  17.     pDst As Any, pSrc As Any, ByVal cBytes As Long _
  18. )
  19.  
  20. Private m_udtMemory         As Memory
  21. Private m_lngDataPosition   As Long
  22.  
  23. Public Sub Initialize(ByVal pData As Long, ByVal DataLen As Long)
  24.     m_udtMemory = AllocMemory(DataLen)
  25.     CpyMem ByVal m_udtMemory.address, ByVal pData, DataLen
  26. End Sub
  27.  
  28. Public Sub Free()
  29.     If m_udtMemory.address <> 0 Then
  30.         FreeMemory m_udtMemory
  31.     End If
  32. End Sub
  33.  
  34. Public Property Get DataPointer() As Long
  35.     DataPointer = m_udtMemory.address
  36. End Property
  37.  
  38. Public Property Get DataSize() As Long
  39.     DataSize = m_udtMemory.bytes
  40. End Property
  41.  
  42. Public Property Get DataPosition() As Long
  43.     DataPosition = m_lngDataPosition
  44. End Property
  45.  
  46. Public Property Let DataPosition(ByVal value As Long)
  47.     m_lngDataPosition = value
  48. End Property
  49.  
  50. Public Property Get DataLeft() As Long
  51.     DataLeft = DataSize - DataPosition
  52. End Property
  53.  
  54. Public Property Get EndOfBuffer() As Boolean
  55.     If m_udtMemory.bytes <= 0 Then
  56.         EndOfBuffer = True
  57.     Else
  58.         EndOfBuffer = DataLeft = 0
  59.     End If
  60. End Property
  61.  
  62. Private Sub Class_Terminate()
  63.     Free
  64. End Sub
  65.