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. Other Discussions
  3. Article Writing
  4. How can I tell programaticly what OS is running

How can I tell programaticly what OS is running

Scheduled Pinned Locked Moved Article Writing
question
4 Posts 4 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.
  • S Offline
    S Offline
    SAK
    wrote on last edited by
    #1

    How can I find out what OS my program is running under. I need to be able to distinguish between NT 4.0 and Win 2K. Regards, SAK

    N L T 3 Replies Last reply
    0
    • S SAK

      How can I find out what OS my program is running under. I need to be able to distinguish between NT 4.0 and Win 2K. Regards, SAK

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #2

      you can use GetVersionEx OSVERSIONINFO.dwMajorVersion will be 4 for NT 4.0 and 5 for Win 2K Nish

      1 Reply Last reply
      0
      • S SAK

        How can I find out what OS my program is running under. I need to be able to distinguish between NT 4.0 and Win 2K. Regards, SAK

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Try this link. :-D Michael Martin Pegasystems Pty Ltd Australia martm@pegasystems.com +61 413-004-018 "Don't belong. Never join. Think for yourself. Peace" - Victor Stone

        1 Reply Last reply
        0
        • S SAK

          How can I find out what OS my program is running under. I need to be able to distinguish between NT 4.0 and Win 2K. Regards, SAK

          T Offline
          T Offline
          TomKat
          wrote on last edited by
          #4

          enum OS_TYPE{ OS_WIN_32s, OS_WIN_NT3, OS_WIN_95, OS_WIN_98, OS_WIN_ME, OS_WIN_NT4, OS_WIN_2000, OS_WIN_XP }; unsigned int GetOSType() { OS_TYPE ShellType; DWORD winVer; OSVERSIONINFO *osvi; winVer=GetVersion(); if(winVer<0x80000000){/*NT */ ShellType=OS_WIN_NT3; osvi= (OSVERSIONINFO *)malloc(sizeof(OSVERSIONINFO)); if (osvi!=NULL){ memset(osvi,0,sizeof(OSVERSIONINFO)); osvi->dwOSVersionInfoSize=sizeof(OSVERSIONINFO); GetVersionEx(osvi); if(osvi->dwMajorVersion==4L)ShellType=OS_WIN_NT4; else if(osvi->dwMajorVersion==5L&&osvi->dwMinorVersion==0L)ShellType=OS_WIN_2000; else if(osvi->dwMajorVersion==5L&&osvi->dwMinorVersion==1L)ShellType=OS_WIN_XP; free(osvi); } } else if (LOBYTE(LOWORD(winVer))<4) ShellType=OS_WIN_32s; else{ ShellType=OS_WIN_95; osvi= (OSVERSIONINFO *)malloc(sizeof(OSVERSIONINFO)); if (osvi!=NULL){ memset(osvi,0,sizeof(OSVERSIONINFO)); osvi->dwOSVersionInfoSize=sizeof(OSVERSIONINFO); GetVersionEx(osvi); if(osvi->dwMajorVersion==4L&&osvi->dwMinorVersion==10L)ShellType=OS_WIN_98; else if(osvi->dwMajorVersion==4L&&osvi->dwMinorVersion==90L)ShellType=OS_WIN_ME; free(osvi); } } return ShellType; } //rate me or hate me I am the mighty keeper of the book on knowledge . Contact me to get your copy .

          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