|
Folks,
Looking for a little advice on how to get this portion of my program working. I am developing a terminal emulation program to help us out at work. It is using multiple winsock controls to connect to various devices. As well, I wish to keep log files for each interaction. I had initially designed this using the FileSystemsObject and then using the OpenTextFile method. Where I am falling down is how to keep track of the textstream objects that will be created. I had thought of just creating a listbox (not visible to the user) to just store the textstream handle in it but this does not work. When you try to use the string that was stored in a .Write method it bombs because it is expecting a textstream object, not a string. I know I may not have explaind this very well but I am really open for further discussion on this. I am at a standstill. Below is a small code snip-it to give a little idea of where I was going.....
'Open the log file for either 'Overwrite' or 'Append'
If (StrComp("Overwrite", retString, vbTextCompare) = 0) Then
Set fs = CreateObject("Scripting.FileSystemObject")
log_handle = "log_handle" & Str(activeTab)
lstFileNumArray.List(CInt(lstControlArray.List(act iveTab))) = log_handle
Set log_handle = fs.OpenTextFile(strLogFile, ForWriting, True)
ElseIf (StrComp("Append", retString, vbTextCompare) = 0) Then
Set fs = CreateObject("Scripting.FileSystemObject")
log_handle = "log_handle_" & Str(activeTab)
lstFileNumArray.List(CInt(lstControlArray.List(act iveTab))) = log_handle
Set log_handle = fs.OpenTextFile(strLogFile, ForAppending, True)
Else
MsgBox "Can't open log file " & strLogFile
End If
|