Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Sub Form_Load()
Dim FEH As Long
Dim Node1 As Node, Node2 As Node
Dim Fnum As Integer
Dim HelpFileName As String
Dim sText As String
Dim FL As Long, I As Long, J As Long
Dim SC As Byte, FC As Byte 'Content Beginning and End Identifiers
Dim SS As Byte, FS As Byte 'Subject Beginning and End Identifiers
Dim ST As Byte, FT As Byte 'Text Beginning and End Identifier
Dim FZ As Byte
Dim S1 As Long
Fnum = FreeFile
HelpFileName = App.Path & "\TextHelp.mhf"
Open HelpFileName For Binary Access Read As Fnum
FL = FSO.GetFile(HelpFileName).Size
ReDim HelpSpace(1 To FL)
Get Fnum, , HelpSpace
Close Fnum
TreeView1.Nodes.Clear
FZ = 241 'Start position of Identifiers
SC = HelpSpace(FZ + 0): FC = HelpSpace(FZ + 1)
SS = HelpSpace(FZ + 2): FS = HelpSpace(FZ + 3)
ST = HelpSpace(FZ + 4): FT = HelpSpace(FZ + 5)
For I = FZ + 48 To FL
Select Case HelpSpace(I)
Case SC: S1 = I + 1
Case FC
sText = ""
For J = S1 To I - 1: sText = sText & Chr(HelpSpace(J)): Next J
Set Node1 = TreeView1.Nodes.Add(, , , sText, 1, 1)
Case SS: S1 = I + 1
Case FS
sText = ""
For J = S1 To I - 1: sText = sText & Chr(HelpSpace(J)): Next J
Set Node2 = TreeView1.Nodes.Add(Node1.Index, tvwChild, , sText, 2, 2)