home *** CD-ROM | disk | FTP | other *** search
/ Troubleshooting Netware Systems / CSTRIAL0196.BIN / attach / msj / v10n10 / vb40.exe / WCIMR.EXE / WCSEARCH.BAS < prev    next >
BASIC Source File  |  1995-10-01  |  4KB  |  154 lines

  1. Attribute VB_Name = "WCIMSearch"
  2. Function FindStringInFolder(StrgFind As String) As String
  3. ' Searches all the threads in a folder for the occurrence
  4. ' of a string
  5.     Dim ThrdMsg As ForumThdMsg
  6.     Dim FNum As Integer
  7.     Dim ThdNum As Integer
  8.     Dim StrgDisp As String
  9.  
  10.     If gNumThreads = 0 Then Exit Function
  11.     
  12.     MainFrm.lvwThreads.ListItems.Clear
  13.  
  14.     StrgDisp = ""
  15.  
  16.     MainFrm.StatBar.Panels(1).TEXT = "Read 0 of " & gNumThreads & "."
  17.  
  18.     MainFrm.ProgBar.MIN = 0
  19.     MainFrm.ProgBar.MAX = gNumThreads
  20.  
  21.     For ThdNum = 1 To gNumThreads
  22.         MainFrm.ProgBar.Value = ThdNum
  23.         DoEvents
  24.         
  25.         ' Some joker hit the Stop Search button!
  26.         If gStopSearch = 1 Then Exit For
  27.         
  28.         MainFrm.StatBar.Panels(1).TEXT = "Read " & ThdNum & " of " & gNumThreads & "."
  29.  
  30.         Select Case msgtype(ThdNum)   'gThreadList(ThdNum).ComHdr.RecType
  31.         Case MT_UNDEF
  32.             Strg$ = ProcessUndef(ThdNum)
  33.         Case MT_EMAIL
  34.             Strg$ = ProcessEMail(ThdNum)
  35.         Case MT_FORMSG
  36.             Strg$ = ProcessMsg(ThdNum)
  37.         Case MT_FORTHD
  38.             Strg$ = ProcessThread(ThdNum)
  39.         Case MT_IPLEX
  40.             Strg$ = ProcessIPlex(ThdNum)
  41.         Case MT_DISP
  42.             Strg$ = ProcessDisp(ThdNum)
  43.         Case MT_ENS
  44.             Strg$ = ProcessNews(ThdNum)
  45.         End Select
  46.  
  47.         ' If we found the string, put the listing in
  48.         ' the list of threads, not in the edit box
  49.         
  50.         If (InStr(Strg$, StrgFind) > 0) Then
  51.             AddThreadToList (ThdNum)
  52.         '    StrgDisp = StrgDisp & Strg$ & Chr$(13) & Chr$(10) & String(70, "=") & Chr$(13) & Chr$(10)
  53.         End If
  54.     Next ThdNum
  55.  
  56. '    MainFrm.EdtMsgText.TEXT = StrgDisp
  57.     FindStringInFolder = ""
  58. End Function
  59.  
  60. Function FindThread(SchStr As String) As Integer
  61.  
  62. FindThread = 0
  63. ' Try ListView.FindItem!
  64. For i = 1 To gNumThreads
  65.     If StrComp(gThreadList(i).ComPStr.Subject.SData, SchStr) = 0 Then
  66.         ' Convert path into 8.3
  67.         FindThread = i
  68.         Exit For
  69.     End If
  70. Next i
  71. End Function
  72.  
  73. Function FindByDate() As Integer
  74.  
  75. End Function
  76.  
  77. Function FindByUID() As Integer
  78.  
  79. ' Searches all the threads in a folder for the occurrence
  80. ' of a sender/recipient
  81.  
  82.     Dim ThrdMsg As ForumThdMsg
  83.     Dim FNum As Integer
  84.     Dim ThdNum As Integer
  85.     Dim StrgDisp As String
  86.     
  87.     Dim UName$, UID$
  88.  
  89.     If gNumThreads = 0 Then Exit Function
  90.  
  91.     MainFrm.lvwThreads.ListItems.Clear
  92.  
  93.     StrgDisp = ""
  94.  
  95.     MainFrm.StatBar.Panels(1).TEXT = "Read 0 of " & gNumThreads & "."
  96.  
  97.     MainFrm.ProgBar.MIN = 0
  98.     MainFrm.ProgBar.MAX = gNumThreads
  99.  
  100.     For ThdNum = 1 To gNumThreads
  101.         MainFrm.ProgBar.Value = ThdNum
  102.         DoEvents
  103.  
  104.         ' Some joker hit the Stop Search button!
  105.         If gStopSearch = 1 Then Exit For
  106.  
  107.         MainFrm.StatBar.Panels(1).TEXT = "Read " & ThdNum & " of " & gNumThreads & "."
  108.  
  109.         Select Case msgtype(ThdNum)   'gThreadList(ThdNum).ComHdr.RecType
  110.         Case MT_UNDEF
  111.             Strg$ = ProcessUndef(ThdNum)
  112.         Case MT_EMAIL
  113.             Strg$ = ProcessEMail(ThdNum)
  114.         Case MT_FORMSG
  115.             Strg$ = ProcessMsg(ThdNum)
  116.         Case MT_FORTHD
  117.             Strg$ = ProcessThread(ThdNum)
  118.         Case MT_IPLEX
  119.             Strg$ = ProcessIPlex(ThdNum)
  120.         Case MT_DISP
  121.             Strg$ = ProcessDisp(ThdNum)
  122.         Case MT_ENS
  123.             Strg$ = ProcessNews(ThdNum)
  124.         End Select
  125.  
  126.         ' If we found the string, put the listing in
  127.         ' the list of threads, not in the edit box
  128.  
  129.  
  130.     UName$ = gThreadList(ThdNum).ComPStr.Creator.SData
  131.     UID$ = gThreadList(ThdNum).ComPStr.CreAddr.SData
  132.     
  133.     If MainFrm.Option1(0).Value = True Then 'Search by name
  134.         If (InStr(UName$, MainFrm.EdtSrchName) > 0) Then
  135.             AddThreadToList (ThdNum)
  136.         End If
  137.     End If
  138.  
  139.     If MainFrm.Option1(1).Value = True Then 'Search by UID
  140.         If (InStr(UID$, MainFrm.EdtSrchUID) > 0) Then
  141.             AddThreadToList (ThdNum)
  142.         End If
  143.     End If
  144.     
  145. 'If MainFrm.Option0(0).Value = True Then ' Search in Sent By
  146. 'If MainFrm.Option0(1).Value = True Then ' Search by Sent To
  147. 'If MainFrm.Option0(2).Value = True Then ' Search by Either
  148.  
  149.     Next ThdNum
  150.     
  151.     FindByUID = 0
  152. End Function
  153.  
  154.