To Petermeachem
'Retained=0'
You can Convert a VB6 project to VB5 :
a TextBox multiline = True and OleDragmode Automatique
(the text : drag your vb6 project file
into this box to change it to vb5 )
Form declarations (no options Explicit)
Const ChunkSize = 4096
a Function :
Private Function FindInString(StartPos As Integer, StrToSearch As String, _
StrToFind As String) As Integer
If Check1.Value = 0 Then
FindInString = InStr(StartPos, UCase(StrToSearch), UCase(StrToFind))
Else
FindInString = InStr(StartPos, StrToSearch, StrToFind)
End If
End Function
a procedure :
Public Sub vb6tovb5(FName$, IDString$, NString$)
Dim tempstring, Msg
Dim PosString, WhereString
Dim FileNumber, A$, NewString$
Dim AString As String * ChunkSize
Dim IsChanged As Boolean
Dim BlockIsChanged As Boolean
Dim NumChanges As Integer
IsChanged = False
BlockIsChanged = False
On Error Resume Next
FileNumber = FreeFile
PosString = 1
WhereString = 0
AString = Space$(ChunkSize)
'Make sure strings have same size
If Len(IDString$) > Len(NString$) Then
NewString$ = NString$ + Space$(Len(IDString$) - Len(NString$))
Else
NewString$ = Left$(NString$, Len(IDString$))
End If
Open FName$ For Binary As FileNumber
NumChanges = 0
If LOF(FileNumber) < ChunkSize Then
A$ = Space$(LOF(FileNumber))
Get #FileNumber, 1, A$
WhereString = FindInString(1, A$, IDString$)
Else
A$ = Space$(ChunkSize)
Get #FileNumber, 1, A$
WhereString = FindInString(1, A$, IDString$)
End If
Do
While WhereString <> 0
tempstring = Left$(A$, WhereString - 1) & NewString$ & Mid$(A$, WhereString + Len(NewString$))
A$ = tempstring
NumChanges = NumChanges + 1
IsChanged = True
BlockIsChanged = True
WhereString = FindInString(WhereString + 1, A$, IDString$)
Wend
If BlockIsChanged Then
Put #FileNumber, PosString, A$
BlockIsChanged = False
End If
PosString = ChunkSize + PosString - Len(IDString$)
' If we're finished, exit the loop
If EOF(FileNumber) Or PosString > LOF(FileNumber) Then
Exit Do
End If
' Get the next chunk to scan
If PosString + ChunkSize > LOF(FileNumber) Then
A$ = Space$(LOF(FileNumber) - PosString + 1)
Get #FileNumber, PosString, A$
WhereString = FindInString(1, A$, IDString$)
Else
A$ = Space$(ChunkSize)
Get #FileNumber, PosString, A$
WhereString = FindInString(1, A$, IDString$)
End If
Loop Until EOF(FileNumber) Or PosString > LOF(FileNumber)
If IsChanged = True Then
MsgBox FName$ & " is now compatible with VB5", vbInformation, "File converted to VB5"
Else
MsgBox "File has not been converted to VB5", vbCritical, "Could not convert"
End If
End Sub
Private Sub Text1_OLEDragDrop(data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim file
If data.GetFormat(vbCFFiles) Then
For Each file In data.Files
If UCase(Right(file, 4)) = UCase(".vbp"

Then
Text4.Text = file
vb6tovb5 Text4.Text, Text2.Text, Text3.Text
Else
MsgBox "Make sure the file extension is .vbp!", vbCritical, "Error"
End If
Next file
Else
MsgBox "Other Error, Please make sure it is a vb Project!!!", vbCritical, "Error"
End If
End Sub
Eric De Decker
vbg.be@vbgroup.nl
Licence And Copy Protection AxtiveX.
Download Demo version on my Site:
Promotions before 02/28/2001 (free source codebook),visite my site