Having trouble with a packaged version of my VB6 app.
I am using Inno Setup which works well, allowing me to run my app on a Windows 7 machine without any versions of VB installed. So far so good . . .
However, the debug data that gets continuously generated as the app runs seems to be vanishing.
The routine that creates debug is as follows:
If I run the setup file from Inno on the same machine (XP) that I use when working with my app, all is well: the exe that is created in Program Files runs perfectly. But when I move the setup file to my Windows 7 machine and use it to create the exe there, in either Program Files (x86) or Program Files, I hit a wall. Although the app runs fine, and although it appears (from Message Box messages I've added to my debug routine) that Filename.dat IS being written to, the resulting filename.dat has nothing new in it.
Any thoughts?
I am using Inno Setup which works well, allowing me to run my app on a Windows 7 machine without any versions of VB installed. So far so good . . .
However, the debug data that gets continuously generated as the app runs seems to be vanishing.
The routine that creates debug is as follows:
Code:
'Routine opens and closes AppFlowDebug.dat EACH TIME data is written
'out, ensuring that full contents will be preserved in the event of a crash.
'Help from:
'[URL unfurl="true"]http://www.tek-tips.com/viewthread.cfm?qid=1471210[/URL]
'VB6 Black Book pp 546 - 564
Public Sub WriteToAppFlowDebug(sNewDebugString As String)
Dim sCurrentRecord As String, sLastRecordText As String, sTempArr() As String
Dim iLoop As Integer, iRep As Integer, iStart As Integer, iStop As Integer
If glFlowDebugRecordCount = 0 Then
Open App.Path & "\PsychExpertAppFlowDebug.dat" For Output As #100
Write #100, "[1] " & sNewDebugString & " [[x 1]]"
glFlowDebugRecordCount = 1
Else
Open App.Path & "\PsychExpertAppFlowDebug.dat" For Input As #100
ReDim Preserve sTempArr(1 To glFlowDebugRecordCount)
'Each record in AppFlowDebug has format Text [[x #]], where # gives the number
'of times the last record has occurred. This will eliminate multiple repetitious
'records.
'Put all current records in AppFlowDebug.dat into the corresponding element of
'sTempArr and note if the last record is a repeat, ie# >1
For iLoop = 1 To glFlowDebugRecordCount
Input #100, sCurrentRecord
sCurrentRecord = Replace(sCurrentRecord, ";", "|") 'Since ;s mess up Instr
sTempArr(iLoop) = sCurrentRecord
If iLoop = glFlowDebugRecordCount Then
iStart = InStr(1, sCurrentRecord, "[[x ", 1) + 4
iStop = InStr(1, sCurrentRecord, "]]", 1)
sLastRecordText = Left(sCurrentRecord, iStart - 7)
iRep = Val(Mid(sCurrentRecord, iStart, iStop - iStart))
End If
Next iLoop
'If the text of the debug record about to be added is the same as the last current
'record don't add a new element to sTempArr, just augment #
iStart = InStr(1, sLastRecordText, "]", 1) '5/10/08
sLastRecordText = Right(sLastRecordText, Len(sLastRecordText) - (iStart + 1))
If sLastRecordText = sNewDebugString Then
sTempArr(glFlowDebugRecordCount) = "[" & glFlowDebugRecordCount & "] " & _
sLastRecordText & " [[x " & CStr(iRep + 1) & "]]"
'Otherwise add it as a new record with # =1
Else
glFlowDebugRecordCount = glFlowDebugRecordCount + 1
ReDim Preserve sTempArr(1 To glFlowDebugRecordCount)
sTempArr(glFlowDebugRecordCount) = "[" & glFlowDebugRecordCount & "] " & _
sNewDebugString & " [[x 1]]"
End If
Close #100
'Update AppFlowDebug.dat using sTempArr
Open App.Path & "\PsychExpertAppFlowDebug.dat" For Output As #100
For iLoop = 1 To glFlowDebugRecordCount
Write #100, sTempArr(iLoop)
Next iLoop
End If
Close #100
End Sub
If I run the setup file from Inno on the same machine (XP) that I use when working with my app, all is well: the exe that is created in Program Files runs perfectly. But when I move the setup file to my Windows 7 machine and use it to create the exe there, in either Program Files (x86) or Program Files, I hit a wall. Although the app runs fine, and although it appears (from Message Box messages I've added to my debug routine) that Filename.dat IS being written to, the resulting filename.dat has nothing new in it.
Any thoughts?