Sub cmdQuit_Click ()
    Dim buf As DataBuffer
    BufferSize = Len(buf)
    buf.Code = -1
    retcode = UnloadDosAp(DosAp, buf, Len(buf))
    If (retcode <> 0) Then
        ErrorMessage (retcode)
    End If
    Unload Form1
    End
End Sub

Sub cmdReverse_Click ()
Dim Buffer As DataBuffer
Dim Length As Long
    Buffer.Code = 1

    Buffer.FirstCount = Len(First.Text)
    Buffer.FirstString = First.Text

    Buffer.LastCount = Len(Last.Text)
    Buffer.LastString = Last.Text

    retcode = SendToDos(DosAp, Buffer, Len(Buffer))
    If (retcode <> 0) Then
        ErrorMessage (retcode)
    End If
    
    retcode = GetFromDos(DosAp, Buffer, Len(Buffer), Length)
    If (retcode <> 0 Or Length > Len(Buffer)) Then
        ErrorMessage (retcode)
    End If
    
    First.Text = RTrim(Buffer.FirstString)
    Last.Text = RTrim(Buffer.LastString)

End Sub

Sub Form_Load ()
    retcode = LoadDosAp("strtest.exe", DosAp, SW_SHOWMINIMIZED, 1024)
    If (retcode <> 0) Then
        ErrorMessage (retcode)
        End
    End If
End Sub

