Thread: How to tell the windows version?

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    2

    How to tell the windows version?

    Hi!

    I need to know if there is a way in borland C++ to tell the windows version under which a C++ program is running.
    I found a command _version that provides the DOS version but nothing to tell the windows version. Can you help?

    Thanks!

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    You could use GetOsVersionEx()

  3. #3
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    I have had to do the exact same thing for apps since XP came out because even though you specify the same size, the window is a different size on an XP screen than a 98 screen (depending on how you create your window of course).

    Code:
    #define   WINXP_MAJOR_VERSION   5
    
      OSVERSIONINFO osvi = {0};
      osvi.dwOSVersionInfoSize = sizeof(osvi);
      GetVersionEx((OSVERSIONINFO*)&osvi);
      if (osvi.dwMajorVersion < WINXP_MAJOR_VERSION)
        //then it is before XP
      else
        //it is at least XP

  4. #4
    Registered User
    Join Date
    Apr 2004
    Posts
    2
    Thanks for the replies but those functions (GetVersionEx and GetOsVersionEx) are not part of the Borland C++ library. I have a very old version of borland C++ (3.1) and I don't know if anyone can help with this.

  5. #5
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Just look at _osmajor (and _osminor if need be). If _osmajor is < 5 it is before XP.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MS Windows Welsh Language Version Available
    By hk_mp5kpdw in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 12-03-2004, 04:59 PM
  2. Windows upgrade question
    By 7smurfs in forum Tech Board
    Replies: 11
    Last Post: 10-20-2004, 01:51 PM
  3. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  4. Version of Windows
    By drdroid in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 08-02-2003, 03:39 PM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM