Article View: borland.public.cppbuilder.nativeapi
Article #17230Re: Windows OS
From: Nick B. Cassos
Date: Sun, 30 Mar 2003 14:27
Date: Sun, 30 Mar 2003 14:27
72 lines
3114 bytes
3114 bytes
Assuming you use VCL, the following function returns both an
enumerated version id, plus a "verbal" one.
enum TWinVer {WUN,W9x,W95,W952,W98,W982,WMe,NT3,NT4,NT5,WXP,NTx};
AnsiString __fastcall WinVerString(TWinVer *AWinVer)
{
AnsiString Result = "Windows ";
TWinVer WinVer;
//IsNT = (Win32Platform == VER_PLATFORM_WIN32_NT);
switch (Win32Platform)
{
case VER_PLATFORM_WIN32_WINDOWS:
if (Win32MajorVersion == 4){
if (Win32MinorVersion < 10)
{
if (Trim(Win32CSDVersion) == "B") // "C" ?
{WinVer = W952; Result += "95 OSR2";}
else
{WinVer = W95 ; Result += "95"; }
}
else
if (Win32MinorVersion < 90)
{
if (Trim(Win32CSDVersion) == "A")
{WinVer = W982; Result += "98 SE"; }
else
{WinVer = W98 ; Result += "98"; }
}
else
{
WinVer = WMe ; Result += "Me";
}}
else{ WinVer = W9x ; Result += "9x"; }
break;
case VER_PLATFORM_WIN32_NT:
switch (Win32MajorVersion)
{
case 3: WinVer = NT3; Result += "NT_3"; break;
case 4: WinVer = NT4; Result += "NT_4"; break;
case 5: if (Win32MinorVersion == 0) {
WinVer = NT5; Result += "2000";}
else {
WinVer = WXP; Result += "XP" ;} break;
default: WinVer = NTx; Result += "NT_X"; break;
}
break;
default: WinVer = WUN; Result += "Old!";
break;
}
if (AWinVer != NULL) *AWinVer = WinVer;
return Result;
}
On Sun, 30 Mar 2003 12:50:28 +0100, "Paul Dowd"
<pauldowd@seisqc.freeserve.co.uk> wrote:
>Hi all,
>
>Is there some way of finding out from within my application what the
>operating system is? I need to be able to distinguish between all Windows OS
>from 95 to XP.
>
>Thanks
>Paul
>
Technical Details
Message-ID:
<5evd8v8v4bep9et98ef2drot1vj4fn45j5@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3e86da10$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,b5c95b47d9c4adfb X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-03-30 06:31:10 PST From: Nick B. Cassos <nbc@no_spam.ath.forthnet.gr> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Windows OS Date: Sun, 30 Mar 2003 17:27:06 +0300 Message-ID: <5evd8v8v4bep9et98ef2drot1vj4fn45j5@4ax.com> References: <3e86da10$1@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 213.16.150.54 X-Trace: newsgroups.borland.com 1049034424 213.16.150.54 (30 Mar 2003 06:27:04 -0800) Lines: 73 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail