Re: Creating Pre and Post build action add-in for VB6
- From: "mayayana" <mayaXXyana1a@xxxxxxxxxxxxxxxx>
- Date: Fri, 15 Jun 2007 13:35:06 GMT
The version number, and everything else seen on
the Properties -> Version window when right-clicking
a file in Explorer, is just plain text. Search the file for
the unicode string VS_VERSION_INFO in a hex editor.
(In other words, V-S-_- where "-" is byte 00.)
You'll find the version data under that. Just edit as
desired (in the hex editor). I've done that before when I
wanted a 3-digit sub-version number. You just want to stay
within the particular data string with your changes. That is,
don't change the length of any version info. string. The
separation between them involves a 00 byte but there seem
to be some cases where there are two 00 bytes between
strings, and some compilers don't seem to be standardized.
So it's best not to fiddle around with the general layout of the
version info. blurb.
Is there a way to a pre- and post build events in a VB6 AddIn?
I'd like to rename a previous existing exe to my.major.minor.revision.exe
for archiving purposes, or I'd like to save the exe / dll currently being
built with such a filename.
I've tried to access the version numbering in my addin but it seems the
object model doesn't expose this information, researching getting the number
from the header of a pre-built exe seems like the next course of action.
Can I access the version numbers in an Add-In via the object model?
Is there a better way to determine the exe being built than looking for exe
in
VBFileControlEvents_DoGetNewFileName
How to access build and version numbers for the exe being built?
How to access the information in an already built exe via
IMAGE_OPTIONAL_HEADER's MajorImageVersion and MinorImageVersion
Private Sub m_objFileControlEvents_DoGetNewFileName( _
ByVal VBProject As VBIDE.VBProject, _
ByVal FileType As VBIDE.vbext_FileType, _
NewName As String, _
ByVal OldName As String, _
CancelDefault As Boolean)
Debug.Print "CFileControlEvents:DoGetNewFileName" & vbCrLf & _
vbTab & "Project " & VBProject.Name & vbCrLf & _
vbTab & "FileType " & FileType & vbCrLf & _
vbTab & "OldName " & OldName & vbCrLf & _
vbTab & "NewName " & NewName
Dim sVersion As String
sVersion = ""
''' This doesn't work
sVersion = VBProject.ReadProperty("", "MajorVer") & _
"." & VBProject.ReadProperty("", "MinorVer") & _
"." & VBProject.ReadProperty("", "RevisionVer")
If (OldName = VBProject.BuildFileName And sVersion <> "") Then
Dim pos As Long: pos = InStrRev(OldName, ".")
NewName = Left(OldName, pos - 1) & "." & sVersion &
VBProject.Right(OldName, pos)
End If
End Sub
.
- References:
- Creating Pre and Post build action add-in for VB6
- From: Joris van Lier
- Creating Pre and Post build action add-in for VB6
- Prev by Date: Re: How to read a remote text file using Visual Basic
- Next by Date: Re: How to read a remote text file using Visual Basic
- Previous by thread: Creating Pre and Post build action add-in for VB6
- Next by thread: OT: Microsoft's .NET Evangelist Spells Out Future Role for Dynamic Languages
- Index(es):
Relevant Pages
|