🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
6 messages
6 total messages Started by Paul Dowd Sun, 30 Mar 2003 11:50
Windows OS
#17226
Author: Paul Dowd
Date: Sun, 30 Mar 2003 11:50
8 lines
1085 bytes
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
Re: Windows OS
#17227
Author: Daniel Pfeffer
Date: Sun, 30 Mar 2003 12:40
17 lines
1456 bytes
"Paul Dowd" <pauldowd@seisqc.freeserve.co.uk> wrote in message
news:3e86da10$1@newsgroups.borland.com...
> 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.

Use the GetVersionEx() API to determine the OS. If you need specific
features of the OS (e.g. a certain service pack), and are running under
Windows 2000/XP - use the VerifyVersionInfo() to determine whether the
system supports your requirements.


HTH
Daniel Pfeffer
Re: Windows OS
#17230
Author: Nick B. Cassos
Date: Sun, 30 Mar 2003 14:27
72 lines
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
>
Re: Windows OS
#17232
Author: Remy Lebeau (TeamB)
Date: Sun, 30 Mar 2003 20:57
18 lines
1377 bytes
Getting the System Version
http://msdn.microsoft.com/library/en-us/sysinfo/base/getting_the_system_vers
ion.asp


Gambit

"Paul Dowd" <pauldowd@seisqc.freeserve.co.uk> wrote in message
news:3e86da10$1@newsgroups.borland.com...

> I need to be able to distinguish between all Windows
> OS from 95 to XP.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 3/17/03
Re: Windows OS
#17238
Author: Paul Dowd
Date: Mon, 31 Mar 2003 09:51
16 lines
1571 bytes
"Nick B. Cassos" <nbc@no_spam.ath.forthnet.gr> wrote in message
news:5evd8v8v4bep9et98ef2drot1vj4fn45j5@4ax.com...
> 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)
> {
...

Many thanks, this works fine. One other query, why do you use __fastcall ? I
though this was only for VCL.

Paul
Re: Windows OS
#17240
Author: Nick B. Cassos
Date: Mon, 31 Mar 2003 13:18
15 lines
1378 bytes
On Mon, 31 Mar 2003 10:51:39 +0100, "Paul Dowd"
<pauldowd@seisqc.freeserve.co.uk> wrote:
>
>Many thanks, this works fine. One other query, why do you use __fastcall ? I
>though this was only for VCL.
>

I use __fastcall anywhere, as long as I stay in BCB. I switch to other
modifiers only when I have to deal with exported dll funcs.

__fastcall is not VCL specific.

-- 

Nick B. Cassos
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads