VB Code:
  1. Private Sub btnRead_Click()
  2.     Dim x As PP2File
  3.     Open "temp.pp2" For Binary As #1
  4.         Get #1, , x
  5.     Close #1
  6.     Dim i As Long
  7.     Dim nd As Node
  8.     Set nd = tvDisplay.Nodes.Add(, , , x.sOwnerName)
  9.     For i = LBound(x.PP2Entries) To UBound(x.PP2Entries)
  10.         Dim ndb As Node
  11.         Set ndb = tvDisplay.Nodes.Add(nd, tvwChild, , x.PP2Entries(i).sName)
  12.         tvDisplay.Nodes.Add ndb, tvwChild, , x.PP2Entries(i).Data
  13.     Next i
  14. End Sub
  15. Private Sub btnWrite_Click()
  16.     Dim x As PP2File
  17.     x.sOwnerName = "Mike Parks"
  18.     ReDim x.PP2Entries(0 To 1)
  19.     x.PP2Entries(0).sName = "Hi there"
  20.     x.PP2Entries(0).Data = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  21.     x.PP2Entries(1).sName = "Different"
  22.     x.PP2Entries(1).Data = "BLAH BLAH BLAH"
  23.     Open "temp.pp2" For Binary As #1
  24.         Put #1, , x
  25.     Close #1
  26. End Sub