Get version from a rc file?
Does anyone know how to get the version from an rc file? Or is there a better way to keep track of version within QT?
When I used MFC I used 'GetModuleFileName' a win api I passed in an 'AfxGetInstanceHandle' which is an MFC call. I really don't want to keep MFC in my qt program.
Thanks for any help!
Re: Get version from a rc file?
I'm not sure how you mean. Do you want to get the version of the resource or the version of you application.
If you saved the application's version as a string resource, you can use a const QString or a define just as well.
Re: Get version from a rc file?
rc files are fairly specific to Windows. ergo, I don't think Qt supports them. Qt has its own resource system to embed resources inside the executable, but is used mostly for storing individual files/graphics, not for plain strings - unless you want to store your string inside a separate file. Otherwise, storing version in a macro #define or const string is fairly typical (and more flexible/portable)
Re: Get version from a rc file?
I tend to use a define in .pro file:
Quote:
# MMmmPP
# MM = major, mm = minor, PP = patch
DEFINES += MYAPP_VERSION=0x031201
Code:
.
arg((MYAPP_VERSION
& 0xFF0000
) >>
16,
2,
16,
QChar('0')) .
arg((MYAPP_VERSION
& 0x00FF00
) >>
8,
2,
16,
QChar('0')) .
arg((MYAPP_VERSION
& 0x0000FF
),
2,
16,
QChar('0'));
// "03.12.01"