Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Problem using Environment.OSversion?

Problem using Environment.OSversion?

Scheduled Pinned Locked Moved C#
helpquestionannouncementworkspace
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Reddy Prakash
    wrote on last edited by
    #1

    I am using Environment.OSVersion for geting the Operation system version. My application is running on Microsoft Windows XP Professional Service pack 2. when i try to retrieve the os version see the code snippet: log.Info("ASET OSVersion=" + Environment.OSVersion); :) i am getting the following output: 2009-03-12 14:18:40,483 [INFO ] [3528] - ASET OSVersion=Microsoft Windows NT 5.1.2600 Service Pack 2 The output should be Micorsoft windows xp , but here it is giving some thing else. :( Can any one help me in this regard?

    S D 2 Replies Last reply
    0
    • R Reddy Prakash

      I am using Environment.OSVersion for geting the Operation system version. My application is running on Microsoft Windows XP Professional Service pack 2. when i try to retrieve the os version see the code snippet: log.Info("ASET OSVersion=" + Environment.OSVersion); :) i am getting the following output: 2009-03-12 14:18:40,483 [INFO ] [3528] - ASET OSVersion=Microsoft Windows NT 5.1.2600 Service Pack 2 The output should be Micorsoft windows xp , but here it is giving some thing else. :( Can any one help me in this regard?

      S Offline
      S Offline
      Spunky Coder
      wrote on last edited by
      #2

      AFAIK XP is recognized as NT platform only. I don't remember it exactly but I think it the OS is determined by 'Environment.OSVersion.version.Minor'. I think if the minor value is 3 it is XP. (I'm not sure...try google)

      "Don't worry if it doesn't work right. If everything did, you'd be out of a job." (Mosher's Law of Software Engineering)

      1 Reply Last reply
      0
      • R Reddy Prakash

        I am using Environment.OSVersion for geting the Operation system version. My application is running on Microsoft Windows XP Professional Service pack 2. when i try to retrieve the os version see the code snippet: log.Info("ASET OSVersion=" + Environment.OSVersion); :) i am getting the following output: 2009-03-12 14:18:40,483 [INFO ] [3528] - ASET OSVersion=Microsoft Windows NT 5.1.2600 Service Pack 2 The output should be Micorsoft windows xp , but here it is giving some thing else. :( Can any one help me in this regard?

        D Offline
        D Offline
        dan sh
        wrote on last edited by
        #3

        You need to extract the product name from Environment.OSVersion.Version.Minor property. If it is 1 then it is XP. All the codes can be found here[^]. IMO to know if it is XP professional or home, you will need to use GetVersionEx by P/Invoking win32 api.

        Happy Holi[^] जय हिंद

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups