[windev] MFC file version checking

OMostovlyansky@iba.by OMostovlyansky at iba.by
Thu Sep 17 08:08:29 GMT 2009


Hallo,

>because it failed for 9.2.0.0 when comparing against 9.1.0.3

of course, because 0 is lower as 3 - here:

>fvi.GetFileVersion(0) >=3D 3

Your old method was not safe in such cases :)

New method seems like more safe... but only if every part of version is
<=3D9. Example:

9.10.0.0 will be greather as 10.0.0.0 (10 000 is < 91 000)

Maybe, common way is something like

if (fvi.GetFileVersion(3) <=3D [oldVersion(3)]) {
    if (fvi.GetFileVersion(2) <=3D [oldVersion(2)]) {
        ...etc. with fvi.GetFileVersion(1) and (0)
    } else bLastVersion =3D TRUE;
} else bLastVersion =3D TRUE;

Mit freundlichen Gr=FC=DFen,
     Oleg A.Mostovlyansky
---------------------------------
IBA (Minsk, Belarus)
Tel: +375 17 217 3228
Mail: OMostovlyansky at iba.by


                                                                           =

             truckleaj-windev@                                             =

             yahoo.co.uk                                                   =

             Sent by:                                                   To =

             windev-bounces at wi         windev at windev.org                   =

             ndev.org                                                   cc =

                                                                           =

                                                                   Subject =

             16.09.2009 22:28          [windev] MFC file version checking  =

                                                                           =

                                                                           =

                                                                           =

                                                                           =

                                                                           =

                                                                           =





Hi

                CString strVersion;
                strVersion.Format(_T("%d%d%d%d"),
                    fvi.GetFileVersion(3),
                    fvi.GetFileVersion(2),
                    fvi.GetFileVersion(1),
                    fvi.GetFileVersion(0));
                int    iVersion =3D _ttoi(strVersion);
                if (iVersion >=3D 9103)
                {
                    m_bIsTMSExplorerInstalled =3D TRUE;
                }
/*
                if(fvi.GetFileVersion(3) >=3D 9 &&
                    fvi.GetFileVersion(2) >=3D 1 &&
                    fvi.GetFileVersion(1) >=3D 0 &&
                    fvi.GetFileVersion(0) >=3D 3)
                {
                    m_bIsTMSExplorerInstalled =3D TRUE;
                }
*/            }



I am trying to find a simple, robust way to check file versions. I can get
at the file version but I am not sure of the safest way to compare it
against a known value. My old method was flawed because it failed for
9.2.0.0 when comparing against 9.1.0.3

Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.windev.org/pipermail/windev/attachments/20090916/cfb8fcc1/atta=
chment.htm

--
Windev mailing list at Windev at windev.org

Lost your password?  Need to unsubscribe or change your delivery options?
Go to http://lists.windev.org/mailman/listinfo/windev
--
Search the Windev Archives - www.windev.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.windev.org/pipermail/windev/attachments/20090917/60a69eb0=
/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
Url : http://lists.windev.org/pipermail/windev/attachments/20090917/60a69eb=
0/graycol.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic10004.gif
Type: image/gif
Size: 1255 bytes
Desc: not available
Url : http://lists.windev.org/pipermail/windev/attachments/20090917/60a69eb=
0/pic10004.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecblank.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://lists.windev.org/pipermail/windev/attachments/20090917/60a69eb=
0/ecblank.gif


More information about the Windev mailing list