Board index » cppbuilder » How to access Project Version info inside C++ application?

How to access Project Version info inside C++ application?


2007-02-17 02:45:40 AM
cppbuilder36
Hello,
How do I access the Borland Builder project "Version Info" from within the
application?
(To be shown in the application "Info" menu-choice)
And can this version Build number be automatically incremented with each
build?
Regards,
Henk
 
 

Re:How to access Project Version info inside C++ application?

This newsgroup is about the C++ programming language, but your
question is not.
Please direct your browser at info.borland.com/newsgroups/ and
read the newsgroup descriptions and guidelines. This will help you
find the appropriate newsgroup for your question.
 

Re:How to access Project Version info inside C++ application?

Thomas,
How is this not a c++ programming question? He's asking how to obtain
the version of the software progrmatically? This is the second time you've
posted this to one of his posts that is programming related.
-Tom
 

{smallsort}

Re:How to access Project Version info inside C++ application?

Quote
How do I access the Borland Builder project "Version Info" from within the
application?
Here's the code to get the version number. Adjust the lblVersion portion
to match your program.
DWORD VersionHandle;
DWORD VersionSize;
void *pBuffer;
VersionSize = GetFileVersionInfoSize(Application->ExeName.c_str(),
&VersionHandle);
if (VersionSize)
{
pBuffer = new char[VersionSize];
if (GetFileVersionInfo(Application->ExeName.c_str(),VersionHandle,
VersionSize,pBuffer))
{
char *b;
UINT buflen;
if (VerQueryValue(pBuffer,
TEXT("\\StringFileInfo\\040904E4\\FileVersion"),
(void** )&b,&buflen))
{
lblVersion->Caption = "v" + AnsiString(b);
}
}
delete[] pBuffer;
}
Quote
And can this version Build number be automatically incremented with each
build?
Look in the Project Options for this. I've never had it work properly
with BCB 6
-Tom
 

Re:How to access Project Version info inside C++ application?

FWIW:
I cannot know Mr Maeder's mind but I think he is referring to the fact that
version information is a platform specific issue and not a language issue.
It might have been more clear had he pointed to the newsgroup
borland.public.cppbuilder.nativeapi
. Ed
Quote
Tom wrote in message
news: XXXX@XXXXX.COM ...

How is this not a c++ programming question? He's asking how to obtain the
version of the software progrmatically? This is the second time you've
posted this to one of his posts that is programming related.
 

Re:How to access Project Version info inside C++ application?

Understood. =) I seldom pay attention
to which group I'm reading as I flip though the
different ones. Though I do try to pick the most
appropriate one when I post.
-Tom
 

Re:How to access Project Version info inside C++ application?

"Tom" < XXXX@XXXXX.COM >writes:
You have made it a language issue now :-)
Quote
>How do I access the Borland Builder project "Version Info" from within the
>application?

Here's the code to get the version number. Adjust the lblVersion portion
to match your program.

DWORD VersionHandle;
DWORD VersionSize;

void *pBuffer;
First, I think it's much better to initialize variables in their
definition. It's easier to not forget to initialize them. And if you
defer the definition of a variable to where you know how to initialize
it, its scope will be narrower.
Quote
VersionSize = GetFileVersionInfoSize(Application->ExeName.c_str(),
&VersionHandle);
if (VersionSize)
{
pBuffer = new char[VersionSize];
Second, it's rarely a good idea to "own" a dynamically allocated
resource with a "raw" pointer. Use a smart pointer or a container
object and the code will be simpler and less error-prone.
Third, why define a void * if it's going to hold the address of a
char? This causes ...
[snip]
Quote
delete[] pBuffer;
this delete [] expression to have undefined behavior.
 

Re:How to access Project Version info inside C++ application?

XXXX@XXXXX.COM (Thomas Maeder [TeamB]) wrote:
Quote

You have made it a language issue now :-)
Great! <g>
groups.google.com/group/borland.public.cppbuilder.nativeapi/msg/e84779ee15f4258f
~ JD