Does wx provide a way to set EXE version numbers? Topic is solved
Does wx provide a way to set EXE version numbers?
I'm doing this in a Windows .rc file right now, but does wx provide any similar facility? Apart from anything else, I'd like the app to be able to show the version number in a help dialog... perhaps wx has a utility method to read the version number from the running EXE?
learn CVS--Concurrent Version-ing Systems
These are available on all platforms.
CVS is one of them.
I know of 3 or 4 others, maybe... kernel.org might point you to some. KDE.org might point you to some. These are linux things but there are windows ports to these systems.
This isn't a well documented structure.
These are available on all platforms.
CVS is one of them.
I know of 3 or 4 others, maybe... kernel.org might point you to some. KDE.org might point you to some. These are linux things but there are windows ports to these systems.
This isn't a well documented structure.
17+ years of c++, currently open watcom and wxWidgets, MFC experience. C::B user.
The world begins again. Are you going to be one of the 2 billion left?
The world begins again. Are you going to be one of the 2 billion left?
-
- I live to help wx-kind
- Posts: 188
- Joined: Tue Jan 27, 2009 6:45 pm
- Location: Germany
- Contact:
Maybe you find here
http://www.codeproject.com/KB/files/fil ... ninfo.aspx
here
http://www.microsoft.com/msj/0498/c0498.aspx
or here
http://code.google.com/p/helictrl/sourc ... svn89&r=89
what you need.
It seems, more comfortable you will get it only from .net (class FileVersionInfo).
http://social.msdn.microsoft.com/forums ... f4fd89d486
I haven't found such a function in wxWidgets (e.g. in wxFileName).
http://www.codeproject.com/KB/files/fil ... ninfo.aspx
here
http://www.microsoft.com/msj/0498/c0498.aspx
or here
http://code.google.com/p/helictrl/sourc ... svn89&r=89
what you need.
It seems, more comfortable you will get it only from .net (class FileVersionInfo).
http://social.msdn.microsoft.com/forums ... f4fd89d486
I haven't found such a function in wxWidgets (e.g. in wxFileName).
-
- I live to help wx-kind
- Posts: 188
- Joined: Tue Jan 27, 2009 6:45 pm
- Location: Germany
- Contact:
It seems, Resources, where FileVersion is stored, is Microsoft/OS2/Windows specific
http://de.wikipedia.org/wiki/Ressource_%28Software%29
maybe the reason, wxWidgets doesn't support reading FileVersion?
http://de.wikipedia.org/wiki/Ressource_%28Software%29
maybe the reason, wxWidgets doesn't support reading FileVersion?
Hi JohnD!
As dlchnr said its windows specific and there is no wx way todo this.
But I would recommend using a simple define and call when the version is needed (cross platform). You just have to update it when you release your app.
EX:
If you still insist on using exe versions. Then the Windows .rc file is the way to set this information. You can not change it under run time but only at compile.
To get the information from an exe, its little bit pain. Every exe has translation of the information in the exe and it must gotten correctly (see ansi code below). Note not every exe has these details.
The info_str can be FileVersion,FileDescription,CompanyName ect see this for a complete list. (Remark section)
As dlchnr said its windows specific and there is no wx way todo this.
But I would recommend using a simple define and call when the version is needed (cross platform). You just have to update it when you release your app.
EX:
Code: Select all
#define APP_VERSION 15
#define APP_VERSION_STR _T("0.0.1.5")
To get the information from an exe, its little bit pain. Every exe has translation of the information in the exe and it must gotten correctly (see ansi code below). Note not every exe has these details.
Code: Select all
wxString GetFileInfo(const wxString& file_path, const wxString& info_str){
//hold return value.
wxString ret;
//WINDOWS
#ifdef __WXMSW__
//variables to use.
char* ver_ptr;
DWORD ver_len;
WORD* lang_info;
UINT lang_len;
wxString sub_block;
LPVOID ver_info;
UINT ver_info_len;
//get file version info size.
if((ver_len = GetFileVersionInfoSize((LPTSTR)file_path.c_str(), &ver_len)) == 0)
return ret;
//alloc memory for buffer.
ver_ptr = new char[ver_len];
//get file version.
if(!GetFileVersionInfo((LPTSTR)file_path.c_str(),0, ver_len, ver_ptr)){
delete[] ver_ptr;
return ret;
}
//get language information.
VerQueryValue(ver_ptr, "\\VarFileInfo\\Translation",
(LPVOID*)&lang_info, &lang_len);
//prepare sub block.
sub_block.Printf("\\StringFileInfo\\%04x%04x\\%s",
lang_info[0], lang_info[1],info_str.c_str());
//get the value from the resource.
if(VerQueryValue(ver_ptr, (LPTSTR)sub_block.c_str(), &ver_info, &ver_info_len))
ret = (char*)ver_info;
//clean up.
delete[] ver_ptr;
#endif
//return value.
return ret;
}
//USAGE
wxString version = GetFileInfo("C:\\Windows\\System32\\cmd.exe","FileVersion");
Thanks
Allonii
Allonii
I think I would just use a #define, except on Windows apps it's nice to set version in the EXE, it just looks a bit more like a 'real' app
I guess I'll keep my RC file for ease of use, anyone know if there's a way to combine a #define with .rc, so the .rc file uses the #define? I know it's not a wx question, but one of you smart guys probably knows if preprocessor can be used in a .rc file?
I guess I'll keep my RC file for ease of use, anyone know if there's a way to combine a #define with .rc, so the .rc file uses the #define? I know it's not a wx question, but one of you smart guys probably knows if preprocessor can be used in a .rc file?
Don't quite understand here, .rc file is just like a header.I guess I'll keep my RC file for ease of use, anyone know if there's a way to combine a #define with .rc, so the .rc file uses the #define?
For example if you have the define in the header called app.h then just do a #include "app.h" in the .rc file and use your defines there. Or you could just define direct in the .rc file. You could set company name, copy right ect.
see this
Thanks
Allonii
Allonii