The win::version class provides simple access to version informations of executables. It loads version numbers and predefined strings.
class win::version {
public:
const unsigned short major;
const unsigned short minor;
const unsigned short release;
const unsigned short build;
const std::wstring comments;
const std::wstring description;
const std::wstring ver;
const std::wstring name;
const std::wstring copyright;
const std::wstring trademarks;
const std::wstring filename;
const std::wstring product;
const std::wstring product_version;
public:
version (const std::wstring & = L"", unsigned int = 0);
private:
version (const version &);
version * operator = (const version &);
};
The win::version object cannot be copied.
On failure, the std::runtime_error is thrown during construction of the object. The exception contains a short description of the problem. Also, the constructor may throw std::bad_alloc in case of internal allocations failure.
You will need to include "ext/win_bits/version.cpp" into your project in order to use win::version. Also the version.dll and psapi.dll must be linked to.
The lookup algorithm tries to access localized versions of the version information table in the following order:
#include <ext/win>
int main () {
win::version app_info;
std::wprintf (L"Initializing %s version %s (%u.%u) ...\n",
app_info.product.c_str (), app_info.ver.c_str (),
app_info.product.major, app_info.product.minor);
// ...
return 0;
};
None.
[index]