• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

OS Version and Name

I want to know how to I find out, using Builder c++ 6, the OS Version and Name.

So that way I can check if is running under windows 95, 98, 2000 or XP

I would like to retrive the os name - e.g. Windows 95 or Windows XP, the version if possible

If someboby can help if a sample code, will be nice

thanks.
0
torlani
Asked:
torlani
  • 3
  • 2
  • 2
2 Solutions
 
Jase-CoderCommented:
I wrote something like that it delphi  here is the source

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=1081&lngWId=7

open the .pas

It is in delphi but the code is easy to understand and it uses some windows API's
0
 
torlaniAuthor Commented:
I understad your code, but I try to implement in Builder and is not working, I not sure what do I have to do so builder will understad the "Win32Platform"

if someone can get a builder example, will help
0
 
Jase-CoderCommented:
Hi
I am, at the minute reconfiguring my whole system. I should have builder reinstalled tomorrow and i'll rewrite the code.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
torlaniAuthor Commented:
no problem ... Thanks again for the help
0
 
George TokasCommented:
This is one way you can use:

OSVERSIONINFO   osinfo;
osinfo.dwOSVersionInfoSize = sizeof(osinfo);
GetVersionEx(&osinfo);

if(osinfo.dwPlatformId == VER_PLATFORM_WIN32s){}// Windows Win32s
if(osinfo.dwPlatformId == VER_PLATFORM_WINDOWS){}// Windows 9x
if(osinfo.dwPlatformId == VER_PLATFORM_WIN32_NT){}// Windows NT XP 2k....

osinfo is a structure.
accessing the dwMajorVersion & dwMinorVersion member you can find out if it is XP, 2k, 2003 etc.

gtokas.
0
 
torlaniAuthor Commented:
sorry gtokas, I mess up in clicking you as the accepted answer, but I gave you 170 points, so it should be ok ... I am sorry for that.
0
 
George TokasCommented:
np...:-)

gtokas.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now