Thoughts from Dan Miser RSS 2.0
# Wednesday, October 13, 2004
In SysUtils, there is a handy function (CheckWin32Version) to check that you are running at least a certain version of Windows. Unfortunately, it is wrong. For example, let's say you want to make sure you are running Win2000 or greater. The following code should do just that:

  if CheckWin32Version(5) then
    CallMyWin2000OrGreaterFunctionHere;
When running on XP, the major version will be 5, and the minor version will be 1. These are stored in writable constants in SysUtils. Inside CheckWin32Version, the check for AMinor is backwards, so your results will be wrong.

I am now using this function instead and everything works fine:


function FixedCheckWin32Version(AMajor: Integer; AMinor: Integer = 0): Boolean;
begin
  Result := (AMajor < Win32MajorVersion) or
            ((AMajor = Win32MajorVersion) and
             (AMinor <= Win32MinorVersion));
end;

Just a side-note: This was fixed in Delphi 7 and above. Of course, if you're using D6, you'll need to use this.

Wednesday, October 13, 2004 5:38:00 PM (GMT Daylight Time, UTC+01:00)  #    Comments [4] -
Delphi
Tracked by:
http://www.google.com/search?q=kcxojlif [Pingback]
http://www.google.com/search?q=vfwhfnwr [Pingback]
http://www.google.com/search?q=pcmnbrqg [Pingback]
http://www.google.com/search?q=ndfvljxr [Pingback]
http://www.google.com/search?q=ingitvbd [Pingback]
http://9nt-information.info/56905369/index.html [Pingback]
http://9nc-information.info/09949478/ladies-navy-work-trousers.html [Pingback]
http://9nl-information.info/58568428/index.html [Pingback]
http://9nd-information.info/12850415/water-balloon-games-for-children.html [Pingback]
http://9nq-information.info/62600508/index.html [Pingback]
http://9nl-information.info/60579676/index.html [Pingback]
http://9nc-information.info/44064713/index.html [Pingback]
http://9np-information.info/98800379/index.html [Pingback]
http://9no-information.info/95032636/ground-turkey-burger-recipes.html [Pingback]
http://9ny-information.info/43994078/index.html [Pingback]
http://9nh-information.info/46134155/chk-centre-hotel-mainfranken.html [Pingback]
http://9nc-information.info/17645113/design-ideas-for-home-gamerooms.html [Pingback]
http://9oj-information.info/69166038/index.html [Pingback]
http://9oj-information.info/37355236/index.html [Pingback]
http://9ot-information.info/75400275/index.html [Pingback]
http://9ok-information.info/03804320/vashti-bunyan-diamond-day-mp3.html [Pingback]
http://9oe-information.info/37424125/index.html [Pingback]
http://9ox-information.info/95758362/compare-computer-processor.html [Pingback]
http://9qg-information.info/60878252/profilo-lamiera-ondulate.html [Pingback]
http://9on-information.info/99940150/index.html [Pingback]
http://9ol-information.info/03753036/index.html [Pingback]
http://9oa-information.info/59412055/morse-medical-inc.html [Pingback]
http://9si-information.info/56299467/index.html [Pingback]
http://9rv-information.info/93856768/index.html [Pingback]
http://9rf-information.info/64573933/index.html [Pingback]
http://9sp-information.info/88685200/index.html [Pingback]
http://9sl-information.info/00311416/chet-baker-jazz-club-bologna.html [Pingback]
http://9ry-information.info/44931405/was-the-four-elms-pub-origilly-a-farm-house... [Pingback]
http://9sh-information.info/77812420/graduatorie-2006-2007.html [Pingback]
http://9sa-information.info/37358048/maurizio-franco.html [Pingback]
http://9uafr-le-informazioni.info/96122020/index.html [Pingback]
http://9uaeb-le-informazioni.info/39533928/index.html [Pingback]
http://9uafh-le-informazioni.info/86366939/index.html [Pingback]
http://9uafh-le-informazioni.info/10788423/index.html [Pingback]
http://9uaes-le-informazioni.info/92525321/index.html [Pingback]
http://9uafe-le-informazioni.info/77168965/officina-farmaceutica-santa-maria-nov... [Pingback]
http://9uaei-le-informazioni.info/34424594/index.html [Pingback]
http://9uaff-le-informazioni.info/08770219/index.html [Pingback]
http://9uafr-le-informazioni.info/34748971/index.html [Pingback]
http://9uahl-le-informazioni.info/47623120/fondo-di-assistenza-sanitaria-turismo... [Pingback]
http://9uags-le-informazioni.info/13181182/index.html [Pingback]
http://9uahh-le-informazioni.info/88526627/klingon-educational-virtual-environme... [Pingback]
http://9uagm-le-informazioni.info/44314524/index.html [Pingback]
http://9uagh-le-informazioni.info/67881459/repubblica-milano.html [Pingback]
http://9uahd-le-informazioni.info/44265233/index.html [Pingback]
http://9uagj-le-informazioni.info/98904736/trucco-segreto-gioco-xbox-360.html [Pingback]
http://9uahl-le-informazioni.info/83958093/wikie.html [Pingback]
Navigation
Archive
<January 2015>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567
Blogroll
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2015
Dan Miser
Sign In
Statistics
Total Posts: 388
This Year: 0
This Month: 0
This Week: 0
Comments: 630
Themes
Pick a theme:
All Content © 2015, Dan Miser
DasBlog theme 'Business' created by Christoph De Baene (delarou)