home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Troubleshooting Netware Systems
/
CSTRIAL0196.BIN
/
attach
/
msj
/
v10n10
/
vb40.exe
/
WCIMR.EXE
/
WCTHRDS.BAS
< prev
Wrap
BASIC Source File
|
1995-10-01
|
6KB
|
222 lines
Attribute VB_Name = "WCIMThreads"
Sub FillThreadList(FoldPath As String)
' Fills the thread list based on the current folder
' This is called when the user double-clicks on the
' Folders tree
Dim CH As CommonHeader
Dim CP As CommonPStrings
Dim FTH As ForumThdHeader
Dim SLen As Byte
Dim FNum As Integer
Dim PicNum As Variant
gNumThreads = 0
ReDim Preserve gThreadList(20)
On Error Resume Next
Set sel = MainFrm.tvwFolders.SelectedItem
Entry$ = sel.Tag
If Err.Number <> 0 Then Exit Sub ' no sel item
MainFrm.lvwThreads.ListItems.Clear
SLen = 1
If (FoldPath = "BASKET.IN") Or (FoldPath = "BASKET.OUT") Then
MyFile = Dir(WCimDir & "\" & FoldPath & "\*.*")
Else
MyFile = Dir(WCimDir & "\CABINET\" & FoldPath & "\*.*")
End If
Do While MyFile <> ""
gNumThreads = gNumThreads + 1
If (gNumThreads > UBound(gThreadList)) Then
ReDim Preserve gThreadList(10 + UBound(gThreadList))
End If
If (FoldPath = "BASKET.IN") Or (FoldPath = "BASKET.OUT") Then
FName = WCimDir & "\" & FoldPath & "\" & MyFile
Else
FName = WCimDir & "\CABINET\" & FoldPath & "\" & MyFile
End If
gThreadList(gNumThreads).FName = FName
gThreadList(gNumThreads).ShortFName = MyFile
FNum = FreeFile
Open FName For Binary Access Read Lock Read As #FNum
RC = GetCommonHeader(FNum, gThreadList(gNumThreads).ComHdr, gThreadList(gNumThreads).ComPStr)
If (RC = False) Then
'LstThreads.AddItem (MyFile)
Set X = MainFrm.lvwThreads.ListItems.Add(, , MyFile)
X.Tag = sel.Tag
' Set the timestamp field
X.SubItems(1) = TSToDate(gThreadList(gNumThreads).ComHdr.Created)
X.SubItems(2) = "Bad file type"
X.SubItems(3) = MyFile
X.SubItems(4) = gNumThreads
GoTo ReadThdBail
End If
Get #FNum, , gThreadList(gNumThreads).Header
Set X = MainFrm.lvwThreads.ListItems.Add(, , gThreadList(gNumThreads).ComPStr.Subject.SData)
X.Tag = MyFile
X.SubItems(3) = MyFile
X.SubItems(4) = gNumThreads
' Set the timestamp field
X.SubItems(1) = TSToDate(gThreadList(gNumThreads).ComHdr.Created)
Select Case gThreadList(gNumThreads).ComHdr.RecType
Case MT_UNDEF
PicNum = picUnknown
X.SubItems(2) = "Undefined file type"
Case MT_EMAIL
PicNum = picMail
X.SubItems(2) = "E-Mail message"
Case MT_FORMSG
PicNum = picForum
X.SubItems(2) = "Forum message"
Case MT_FORTHD
PicNum = picThread
X.SubItems(2) = "Forum thread"
Case MT_IPLEX
PicNum = picUnknown
X.SubItems(2) = "Infoplex message"
Case MT_DISP
PicNum = picMail
X.SubItems(2) = "Display message"
Case MT_ENS
PicNum = picNews
X.SubItems(2) = "News item"
Case Else
PicNum = picUnknown
X.SubItems(2) = "Unknown file type"
End Select
ReadThdBail:
Close #FNum
On Error Resume Next
MyFile = Dir
If Err.Number <> 0 Then Exit Sub
DoEvents
Loop
End Sub
Sub AddThreadToList(N As Integer)
' Adds a thread (by number) to the list of found threads.
' This is called when the user invokes a search.
On Error Resume Next
Set X = MainFrm.lvwThreads.ListItems.Add(, , gThreadList(N).ComPStr.Subject.SData)
X.Tag = gThreadList(N).ShortFName
X.SubItems(3) = gThreadList(N).ShortFName
X.SubItems(4) = N
' Set the timestamp field
X.SubItems(1) = TSToDate(gThreadList(N).ComHdr.Created)
Select Case gThreadList(N).ComHdr.RecType
Case MT_UNDEF
PicNum = picUnknown
X.SubItems(2) = "Undefined file type"
Case MT_EMAIL
PicNum = picMail
X.SubItems(2) = "E-Mail message"
Case MT_FORMSG
PicNum = picForum
X.SubItems(2) = "Forum message"
Case MT_FORTHD
PicNum = picThread
X.SubItems(2) = "Forum thread"
Case MT_IPLEX
PicNum = picUnknown
X.SubItems(2) = "Infoplex message"
Case MT_DISP
PicNum = picMail
X.SubItems(2) = "Display message"
Case MT_ENS
PicNum = picNews
X.SubItems(2) = "News item"
Case Else
PicNum = picUnknown
X.SubItems(2) = "Unknown file type"
End Select
ReadThdBail:
If Err.Number <> 0 Then Exit Sub
DoEvents
End Sub
Sub ResetThreadList()
' Refills the thread list after a search is cancelled
' This procedure is similar to FillThreadList, except that
' the files are not re-read.
On Error Resume Next
For N = 1 To gNumThreads
Set X = MainFrm.lvwThreads.ListItems.Add(, , gThreadList(N).ComPStr.Subject.SData)
X.Tag = gThreadList(N).ShortFName
X.SubItems(3) = gThreadList(N).ShortFName
X.SubItems(4) = N
' Set the timestamp field
X.SubItems(1) = TSToDate(gThreadList(N).ComHdr.Created)
Select Case gThreadList(N).ComHdr.RecType
Case MT_UNDEF
PicNum = picUnknown
X.SubItems(2) = "Undefined file type"
Case MT_EMAIL
PicNum = picMail
X.SubItems(2) = "E-Mail message"
Case MT_FORMSG
PicNum = picForum
X.SubItems(2) = "Forum message"
Case MT_FORTHD
PicNum = picThread
X.SubItems(2) = "Forum thread"
Case MT_IPLEX
PicNum = picUnknown
X.SubItems(2) = "Infoplex message"
Case MT_DISP
PicNum = picMail
X.SubItems(2) = "Display message"
Case MT_ENS
PicNum = picNews
X.SubItems(2) = "News item"
Case Else
PicNum = picUnknown
X.SubItems(2) = "Unknown file type"
End Select
Next N
ReadThdBail:
If Err.Number <> 0 Then Exit Sub
DoEvents
End Sub