Re: Creating Pre and Post build action add-in for VB6

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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


.



Relevant Pages

  • Re: Shell Functions and DOS executables
    ... Before you relocate the exe because of the short file name limitation of the ... ByVal lpszShortPath As String, _ ... Dim sShortPath As String ... Reports "Error Converting filename.wfm" if NOT successful ...
    (microsoft.public.vb.general.discussion)
  • Re: Working with a .exe file
    ... I think the trouble might be that Shell doesn't wait till the .exe is fully launched, ... lpReserved As String ... Private Declare Function WaitForSingleObject _ ... Dim lReturn As Long ...
    (microsoft.public.excel.programming)
  • RE: SoapHttpClientProtocol request canceled
    ... - VB.NET 2002 client dll that talks to the webservice. ... The VB.NET exe and the VB6 exe both use VB.NET dll to sent request/response ... > inputHeaderer, String messageControlPayload, string inputMessage) ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Hex Editor & VB6
    ... recent that the EXE is built from. ... every single instance of this string needs to be changed in the EXE. ... Are you absolutely sure that the string "@foober.com" is contained in the source code you compiled from in exactly that fashion (as a specific "whole string" within a Case statement or something similar? ... If you cannot find the string in your own compiled exe then are you sure that the above lines of code were actually contained within the source code when you compiled it, and that you performed a standard native code or pcode compile and have not used anything and the source code does not contain anything that might deliberately make the string difficult to find? ...
    (microsoft.public.vb.general.discussion)
  • Creating Pre and Post build action add-in for VB6
    ... 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. ... ByVal OldName As String, _ ...
    (microsoft.public.vb.general.discussion)