VB icon

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

Email
Submitted on: 1/7/2015 12:51:00 PM
By: Anonymous (from psc cd)  
Level: Intermediate
User Rating: By 3 Users
Compatibility: VB 5.0, VB 6.0
Views: 611
 
     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.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Convert VB6 to VB5 every time a project loads! *** Updated version! ***
' Description: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.
' By: Anonymous (from psc cd)
'
' Inputs:Call from windows
'
' Returns:A call to VB
'
' Assumes: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.
'
' 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, "\")
 Wend
 
 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
 Else
 If property = "Retained=1" Then
Else
If property = "DebugStartupOption=0" Then
Else
If property = "DebugStartupOption=1" Then
 Else
 newfile = newfile & property & vbCrLf
End If
End If
 End If
 End If
 Loop
 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 & "\"
 Else
 apppath = App.Path
 End If
 Path = GetPathAndFileName(Command, File)
 ShortPath = GetShortPath(Path)
 cmdline = apppath & "Vb5.exe " & ShortPath & "\" & File
 RetVal = Shell(cmdline, vbNormalFocus)
 End
End Sub


Other 209 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.