|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to get OS name?Environment.OSVersion.ToString() but that returns me something like: Microsoft Windows NT 5.1.2600 Service Pack 2 where as I was hoping for something like Windows XP Service Pack 2 How to get Windows XP ? I saw some code elsewhere which hard coded the following: OperatingSystem osinfo = Environment.OSVersion; if (osinfo.Version.Minor == 4) return "Microsoft Windows NT"; if (osinfo.Version.Major == 5 && osinfo.Version.Minor == 0) return "Microsoft Windows 2000"; if (osinfo.Version.Major == 5 && osinfo.Version.Minor == 1) return "Microsoft Windows XP"; But it's not very much future proof. Any suggestion? -- Regards, Lloyd Dupont NovaMind development team NovaMind Software Mind Mapping Software <www.nova-mind.com> The real names of the OS versions aren't the same as the popular commercial names.
XP is NT 5.1 W2K3 is NT 5.2 Vista is NT 6.0 and will remain like this, so what makes you think the code isn't future proof? Willy. "Lloyd Dupont" <net.galador@ld> wrote in message news:Osu6DbrMGHA.2040@TK2MSFTNGP14.phx.gbl... I tried something like:Environment.OSVersion.ToString() but that returns me something like: Microsoft Windows NT 5.1.2600 Service Pack 2 where as I was hoping for something like Windows XP Service Pack 2 How to get Windows XP ? I saw some code elsewhere which hard coded the following: OperatingSystem osinfo = Environment.OSVersion; if (osinfo.Version.Minor == 4) return "Microsoft Windows NT"; if (osinfo.Version.Major == 5 && osinfo.Version.Minor == 0) return "Microsoft Windows 2000"; if (osinfo.Version.Major == 5 && osinfo.Version.Minor == 1) return "Microsoft Windows XP"; But it's not very much future proof. Any suggestion? -- Regards, Lloyd Dupont NovaMind development team NovaMind Software Mind Mapping Software <www.nova-mind.com> "Willy Denoyette [MVP]" <willy.denoye***@telenet.be> wrote in message news:%23fBP1OuMGHA.3272@tk2msftngp13.phx.gbl... The real names of the OS versions aren't the same as the popular commercial names.XP is NT 5.1 W2K3 is NT 5.2 Vista is NT 6.0 and will remain like this, so what makes you think the code isn't future proof? It's missing human friendly name for the OS. now that you tell me W2K3 & Vista, I could add them in the translation, but it was not there and what about Longhorn server? i.e. instead of hardcoding Major+Minor => friendly name, I would like to have a library function (persumably to be updated by MS along the way) doing it for me. Willy. "Lloyd Dupont" <net.galador@ld> wrote in message news:Osu6DbrMGHA.2040@TK2MSFTNGP14.phx.gbl... I tried something like:Environment.OSVersion.ToString() but that returns me something like: Microsoft Windows NT 5.1.2600 Service Pack 2 where as I was hoping for something like Windows XP Service Pack 2 How to get Windows XP ? I saw some code elsewhere which hard coded the following: OperatingSystem osinfo = Environment.OSVersion; if (osinfo.Version.Minor == 4) return "Microsoft Windows NT"; if (osinfo.Version.Major == 5 && osinfo.Version.Minor == 0) return "Microsoft Windows 2000"; if (osinfo.Version.Major == 5 && osinfo.Version.Minor == 1) return "Microsoft Windows XP"; But it's not very much future proof. Any suggestion? -- Regards, Lloyd Dupont NovaMind development team NovaMind Software Mind Mapping Software <www.nova-mind.com> The framework calls a Win32 API function which returns the major/minor version in a structure OSVERSIONINFOEX. However, there is no such thing as a "friendly name" baked in the system, so you'll have to construct one yourself I'm affraid. Note also that the Official name for all NT based systems is Microsoft Windows NT Version x.y,
where x is 4 for NT4 5 for W2K, XP and W2K3 and 6 for Vista and "Longhorn server" and y is 0 for NT4, W2K, Vista and "LH" 1 for XP 32 bit 2 for W2K3, W2K3 R2 and XP 64 bit. Willy. PS. "Longhorn Server" is still a project alias. "Lloyd Dupont" <net.galador@ld> wrote in message news:u89sG$uMGHA.1460@TK2MSFTNGP10.phx.gbl... The real names of the OS versions aren't the same as the popular commercial names."Willy Denoyette [MVP]" <willy.denoye***@telenet.be> wrote in message news:%23fBP1OuMGHA.3272@tk2msftngp13.phx.gbl... XP is NT 5.1 W2K3 is NT 5.2 Vista is NT 6.0 and will remain like this, so what makes you think the code isn't future proof? It's missing human friendly name for the OS. now that you tell me W2K3 & Vista, I could add them in the translation, but it was not there and what about Longhorn server? i.e. instead of hardcoding Major+Minor => friendly name, I would like to have a library function (persumably to be updated by MS along the way) doing it for me. Willy. "Lloyd Dupont" <net.galador@ld> wrote in message news:Osu6DbrMGHA.2040@TK2MSFTNGP14.phx.gbl... I tried something like:Environment.OSVersion.ToString() but that returns me something like: Microsoft Windows NT 5.1.2600 Service Pack 2 where as I was hoping for something like Windows XP Service Pack 2 How to get Windows XP ? I saw some code elsewhere which hard coded the following: OperatingSystem osinfo = Environment.OSVersion; if (osinfo.Version.Minor == 4) return "Microsoft Windows NT"; if (osinfo.Version.Major == 5 && osinfo.Version.Minor == 0) return "Microsoft Windows 2000"; if (osinfo.Version.Major == 5 && osinfo.Version.Minor == 1) return "Microsoft Windows XP"; But it's not very much future proof. Any suggestion? -- Regards, Lloyd Dupont NovaMind development team NovaMind Software Mind Mapping Software <www.nova-mind.com> Thanks Willy! :-)
-- Regards, Lloyd Dupont NovaMind development team NovaMind Software Mind Mapping Software <www.nova-mind.com> "Willy Denoyette [MVP]" <willy.denoye***@telenet.be> wrote in message news:%23yZ%23PbxMGHA.208@tk2msftngp13.phx.gbl... The framework calls a Win32 API function which returns the major/minor version in a structure OSVERSIONINFOEX. However, there is no such thing as a "friendly name" baked in the system, so you'll have to construct one yourself I'm affraid. Note also that the Official name for all NT based systems is Microsoft Windows NT Version x.y, where x is 4 for NT4 5 for W2K, XP and W2K3 and 6 for Vista and "Longhorn server" and y is 0 for NT4, W2K, Vista and "LH" 1 for XP 32 bit 2 for W2K3, W2K3 R2 and XP 64 bit. Willy. PS. "Longhorn Server" is still a project alias. "Lloyd Dupont" <net.galador@ld> wrote in message news:u89sG$uMGHA.1460@TK2MSFTNGP10.phx.gbl... The real names of the OS versions aren't the same as the popular commercial names."Willy Denoyette [MVP]" <willy.denoye***@telenet.be> wrote in message news:%23fBP1OuMGHA.3272@tk2msftngp13.phx.gbl... XP is NT 5.1 W2K3 is NT 5.2 Vista is NT 6.0 and will remain like this, so what makes you think the code isn't future proof? It's missing human friendly name for the OS. now that you tell me W2K3 & Vista, I could add them in the translation, but it was not there and what about Longhorn server? i.e. instead of hardcoding Major+Minor => friendly name, I would like to have a library function (persumably to be updated by MS along the way) doing it for me. Willy. "Lloyd Dupont" <net.galador@ld> wrote in message news:Osu6DbrMGHA.2040@TK2MSFTNGP14.phx.gbl... I tried something like:Environment.OSVersion.ToString() but that returns me something like: Microsoft Windows NT 5.1.2600 Service Pack 2 where as I was hoping for something like Windows XP Service Pack 2 How to get Windows XP ? I saw some code elsewhere which hard coded the following: OperatingSystem osinfo = Environment.OSVersion; if (osinfo.Version.Minor == 4) return "Microsoft Windows NT"; if (osinfo.Version.Major == 5 && osinfo.Version.Minor == 0) return "Microsoft Windows 2000"; if (osinfo.Version.Major == 5 && osinfo.Version.Minor == 1) return "Microsoft Windows XP"; But it's not very much future proof. Any suggestion? -- Regards, Lloyd Dupont NovaMind development team NovaMind Software Mind Mapping Software <www.nova-mind.com> |
|||||||||||||||||||||||