Search Tools Links Login

Convert VB6 to VB5 every time a project loads! *** Updated version! ***

This program converts the VB6 project file to VB5, before opening VB to open the file. If the file is already VB5 compatible it will leave it alone. Compile the file to the same folder
where Vb5.exe is and then hold down SHIFT
while right clicking on a .vbp file. Choose Open with... then click on other and choose the file that you compiled. Now whenever you open a .vbp file it will convert it then allow VB to open it. NOTE: if there are more tags that are not VB5 compatible, please tell me. The old version did not work with project files that had a space in the path, but this version is compatible. If you like this app, please rate it.

Original Author: unknown


Call from windows


When you compile it the .exe file needs to be in the same folder as Vb5.exe and this only works when the file is opened from Windows. If you open the file in VB itself, the conversion will not take place.


A call to VB

Side Effects

None that I know of


' Make a project with only a module and put this
' in it:
Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal lBuffer As Long) As Long
Public Function GetShortPath(strFileName As String) As String
Dim lngRes As Long, strPath As String
strPath = String$(165, 0)
lngRes = GetShortPathName(strFileName, strPath, 164)
GetShortPath = Left$(strPath, lngRes)
End Function
Public Function GetPathAndFileName(ByVal PathAndFileName, ByRef FileName As String) As String
Dim lPos As Long
Dim lLastPos As Long

lPos = InStr(1, PathAndFileName, "")
While lPos <> 0
lLastPos = lPos
lPos = InStr(lLastPos + 1, PathAndFileName, "")

GetPathAndFileName = Left(PathAndFileName, lLastPos - 1)
FileName = Mid(PathAndFileName, lLastPos + 1)

End Function
Sub Main()
On Error Resume Next
Dim property As String
Dim newfile As String
Open Command For Input As #1
Do Until EOF(1)
Line Input #1, property
If property = "Retained=0" Then
If property = "Retained=1" Then
  If property = "DebugStartupOption=0" Then
  If property = "DebugStartupOption=1" Then
   newfile = newfile & property & vbCrLf
  End If
  End If
End If
End If
Close #1
Open Command For Output As #1
Print #1, newfile
Close #1
Dim RetVal
Dim Path As String
Dim File As String
Dim ShortPath
Dim apppath, cmdline
If Len(App.Path) <> 2 Then 'if path is not root, add a ""
apppath = App.Path & ""
apppath = App.Path
End If
Path = GetPathAndFileName(Command, File)
ShortPath = GetShortPath(Path)
cmdline = apppath & "Vb5.exe " & ShortPath & "" & File
RetVal = Shell(cmdline, vbNormalFocus)
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 94 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.