Trace Strings containing colons are not displayed

Summary

Id: 3547.1
Type: Bug Bug
Current Status: Open

Detail

19 Mar 2003 Open Christian.Busler

I found a small problem in the VB6 Tracer utility you provide on vbaccelerator.com and thought you might want to know.

If the String that is posted as data contains any additional colons besides the ones after Exename, HInstance, etc. then the part of the string between the colon after DateTime and the additional colon will be cut out and not displayed in the output window's textbox.

The code below fixes this problem (frmMessageWindow.processData):

Private Function processData(ByRef sData As String) As String
Dim iPos As Long
Dim iNextPos As Long
Dim sRet As String
Dim iState As Long
   iPos = 1
   Do
      iNextPos = InStr(iPos, sData, ": ")
      If (iNextPos > 0) Then
         Select Case iState
         Case 0
            If (g_cConfiguration.ShowExeName) Then
               sRet = sRet & Mid$(sData, iPos, iNextPos - iPos + 1)
            End If
         Case 1
            If (g_cConfiguration.ShowHInstance) Then
               sRet = sRet & Mid$(sData, iPos, iNextPos - iPos + 1)
            End If
         Case 2
            If (g_cConfiguration.ShowThreadId) Then
               sRet = sRet & Mid$(sData, iPos, iNextPos - iPos + 1)
            End If
         Case 3
            If (g_cConfiguration.ShowDateTime) Then
               sRet = sRet & Mid$(sData, iPos, iNextPos - iPos + 1)
            End If
         Case Else
            ' another : in the string
            sRet = sRet & Mid$(sData, iPos, iNextPos - iPos + 1)
         End Select
         iState = iState + 1
         iPos = iNextPos + 2
      End If
   Loop While (iNextPos > 0)
   sRet = sRet & Mid$(sData, iPos)
   processData = sRet
   
End Function

Have a nice day.

Best Regards

Chris