LOTUSSCRIPT/COM/OLE CLASSES


Examples: Close method
This example gets information on the normal files in a directory by opening each file as a stream. The agent reuses the same NotesStream object by opening and closing it for each file.

Sub Initialize
 Dim session As New NotesSession
 Dim stream As NotesStream
 Set stream = session.CreateStream
 files& = 0
 bytes& = 0
 directory$ = "C:\StreamFiles"
 Chdir directory$
 file$ = Dir$("*.*")
 While file$ <> ""
   If Not stream.Open(path$ & file$) Then
     Messagebox file$,, "Open failed"
     Exit Sub
   End If
   files& = files& + 1
   bytes& = bytes& + stream.Bytes
   Call stream.Close
   file$ = Dir$()
 Wend
 Messagebox "Number of files = " & files& & Chr(13) & _
 "Total bytes = " & bytes&,, "Normal files in " & directory$
End Sub

See Also