Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Version of my program

9 views
Skip to first unread message

Massimo

unread,
Oct 20, 1998, 3:00:00 AM10/20/98
to
Sorry for my english...

How i can insert in a simple form a version and build of my program
inserted in exe file with the project option and visible only with
proprierty of file in the explorer ?

Thanks in advanced.

Imran Hussain

unread,
Oct 20, 1998, 3:00:00 AM10/20/98
to Massimo
Hi,
I have written a VCL to do that. You can download it from
http://www.imranweb.com/freesoft

Source code is included.

Thanks,

--
===========================================
Imran Hussain
MCP, MCSD
imr...@imranweb.com
http://www.imranweb.com
===========================================

Remy Lebeau

unread,
Oct 20, 1998, 3:00:00 AM10/20/98
to
Try this code in whatever form you want the version info displayed (works
for me):


void __fastcall TAboutBoxForm::FormCreate(TObject *Sender)
{
DWORD dwResulut;
bool bResult;
unsigned int uiResulut;
DWORD EmptyHandle;
void* VersionData;
char* Version;
char* Build;

try
{
dwResulut = GetFileVersionInfoSize(Application->ExeName.c_str(),
&EmptyHandle);
VersionData = new BYTE [dwResulut];
bResult = GetFileVersionInfo(Application->ExeName.c_str(), 0,
dwResulut, VersionData);
if(!bResult)
{
delete VersionData;
return;
}
VerQueryValue(VersionData,
TEXT("\\StringFileInfo\\040904E4\\FileVersion"), (void**)&Build,
&uiResulut);

BuildNumberText->Caption = Build;
VersionNumberText->Caption = Version;
}
catch (...)
{
delete VersionData;
}
delete VersionData;
}


Where BuildNumberText and VersionNumberText are TLabels.


Gambit

Massimo wrote in message <70itmd$f1...@forums.borland.com>...

Assembler

unread,
Oct 21, 1998, 3:00:00 AM10/21/98
to
Very simple

1. Go to Projects/Options menu (Shift-Ctrl-F11)
2. Select Version info tab
3. Check 'Include version information in project' check box
4. Set the values

and voila

Dave Fenwick (TeamB)

unread,
Oct 21, 1998, 3:00:00 AM10/21/98
to
Massimo wrote in message <70itmd$f1...@forums.borland.com>...
>Sorry for my english...
>
>How i can insert in a simple form a version and build of my program
>inserted in exe file with the project option and visible only with
>proprierty of file in the explorer ?
>
>Thanks in advanced.
>
>

What version of Builder? If it's 3.0, just set it in the project options.
It's a simple resource. :-)

----------------------------------------------------------------------------
David J. Fenwick d...@assetsw.com
Nomadic Developer Asset Software, Inc.
Proud Member of Inprise's TeamB
"We'll do anything if you don't pay us."

Chris Uzdavinis (TeamB)

unread,
Oct 21, 1998, 3:00:00 AM10/21/98
to
Dave Fenwick (TeamB) wrote:
> What version of Builder? If it's 3.0, just set it in the project options.
> It's a simple resource. :-)

I think he wanted to know how to retrieve the information, not how
to set it. :)

Here is some barely-tested code, but it appears to work. MS help for
VerQueryValue does not specify who is responsible for deleting the
data that it returns through the provided pointer, and I don't delete
it so there may be a leak. But even if there is, your TAbout form can
be autocreated and thus only leak one time harmlessly. If it is
dynamically created, then it'll leak every time someone call
Help|About, but even then it probably won't happen enough to cause
much harm.

Anybody know if I'm supposed to delete the buffer returned from
VerQueryValue, or does the OS miraculously manage it for me, since it
allocated it? My guess is that it does not need deleting, as it
probably points to the memory image of the string resource directly.

Hope this helps, Massimo.


bool
GetBuildVersionNumbers(String *buildstr, String *versionstr)
{
bool retval = false;
if (!buildstr || !versionstr)
return retval;

DWORD size;
bool success;
void* data;

try
{
DWORD ignored;
size =
GetFileVersionInfoSize(Application->ExeName.c_str(),&ignored);
data = new BYTE [size];
success = GetFileVersionInfo(Application->ExeName.c_str(), 0,
size, data);

if(success)
{
size_t build_size, version_size;
char* build;
char* version;

VerQueryValue(data,


TEXT("\\StringFileInfo\\040904E4\\FileVersion"),

(void**)&build,
&build_size);

VerQueryValue(data,

TEXT("\\StringFileInfo\\040904E4\\ProductVersion"),
(void**)&version,
&version_size);

if (version_size)
*versionstr = version;

if (build_size)
*buildstr = build;

retval = true;
}
}
__finally
{
delete [] data;
}
return retval;
}

//---------------------------------------------------------------------
void __fastcall TAbout::FormCreate(TObject *Sender)
{
String build, version;

if (GetBuildVersionNumbers(&build, &version))
BuildLabel->Caption = String("Version: ") + build;
else
BuildLabel->Caption = "Version: Unknown";
}
//---------------------------------------------------------------------

--
Chris (TeamB)

Dave Fenwick (TeamB)

unread,
Oct 21, 1998, 3:00:00 AM10/21/98
to
Chris Uzdavinis (TeamB) wrote in message
<362E1019...@uzdavinis.com>...

>Dave Fenwick (TeamB) wrote:
>> What version of Builder? If it's 3.0, just set it in the project
options.
>> It's a simple resource. :-)
>
> I think he wanted to know how to retrieve the information, not how
>to set it. :)
>


I don't think so. Reread the original post. I think he wants to see the
file information when he right clicks on it in Explorer and selects
"Properties". That's how I read it. :-)

Chris Uzdavinis (TeamB)

unread,
Oct 21, 1998, 3:00:00 AM10/21/98
to
Dave Fenwick (TeamB) wrote:

> I don't think so. Reread the original post. I think he wants to see the
> file information when he right clicks on it in Explorer and selects
> "Properties". That's how I read it. :-)

I did reread it and I still think the same way. :) He says he wants
to insert the version and build into a simple form. The part about it
being visible in the explorer is to just define the numbers about
which he's speaking. I think. :)

How i can insert in a simple form a version and build
of my program inserted in exe file with the project
option and visible only with proprierty of file in
the explorer ?

OK, Massimo, which way is it? Settle this for us... <grin>
--
Chris (TeamB)

Dave Fenwick (TeamB)

unread,
Oct 22, 1998, 3:00:00 AM10/22/98
to
Chris Uzdavinis (TeamB) wrote in message
<362E5DBF...@uzdavinis.com>...

>
>I did reread it and I still think the same way. :) He says he wants
>to insert the version and build into a simple form. The part about it
>being visible in the explorer is to just define the numbers about
>which he's speaking. I think. :)
>


TASTES GREAT!

0 new messages