473,385 Members | 1,325 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

getting the OS and distinguishing between XP Home and XP Pro?

I have a program that uses the System.Environment.OSVersion to report
on the platform where it's running:

Console.WriteLine(System.Environment.OSVersion.ToS tring());
Console.WriteLine(System.Environment.OSVersion.Pla tform.ToString());
Console.WriteLine(System.Environment.OSVersion.Ver sion.ToString());

However this code gives the same output on both XP Home and XP Pro:

Microsoft Windows NT 5.1.2600.0
Win32NT
5.1.2600.0

What C# call could I use to find out if I'm running on XP Home or XP
Pro?

-Bennett
Nov 15 '05 #1
2 1570
Bennett,
What C# call could I use to find out if I'm running on XP Home or XP
Pro?


I think you have to call the GetVersionEx API via P/Invoke and check
if OSVERSIONINFOEX.wSuiteMask contains VER_SUITE_PERSONAL.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 15 '05 #2
> Console.WriteLine(System.Environment.OSVersion.ToS tring());
Console.WriteLine(System.Environment.OSVersion.Pla tform.ToString()); Console.WriteLine(System.Environment.OSVersion.Ver sion.ToString());
However this code gives the same output on both XP Home and XP Pro:

Microsoft Windows NT 5.1.2600.0
Win32NT
5.1.2600.0


I have no idea how to do it with pure .NET libraries.

However, with GetVersionEx() from Win32API you just check the field
wSuiteMask of OSVERSIONINFOEX structure to distinguish XPHome from XPPro.
Probably you'll have to PInvoke GetVersionEx().

look at
http://msdn.microsoft.com/library/de...us/sysinfo/bas
e/osversioninfoex_str.asp for more details.

Regards, Wiktor
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: leke | last post by:
Hi, I am trying to learn PHP but am having some problems getting my code running in Explorer 6. <html> <head> <title>PHP Test</title> </head> <body> <?php echo '<p>Hello World</p>'; ?>...
3
by: Kali K E | last post by:
Hi, I could not understand how I can do the following things in Python. Please help me. 1. First I have to find the current directory from where the script is invoked. 2. Next I have to form a...
3
by: Dr. Laurence Leff | last post by:
I am having trouble doing the basics with xmlto on Redhat to convert DocBook XML into the various files. I believe the problem is the first line on the files: Here is starter file (notes.xml):...
30
by: Stuart Turner | last post by:
Hi Everyone, I'm working hard trying to get Python 'accepted' in the organisation I work for. I'm making some good in-roads. One chap sent me the text below on his views of Python. I wondered...
2
by: Maziar Aflatoun | last post by:
Hi, I have two sections on one .aspx page. One is a datagrid which lists the current users allowing you to edit them as well and on the bottom of my page I have 'Add a new user' section with...
1
by: louismanukonda | last post by:
I'm newbie to xml I have an xml grammer file contain image files, i have to display the contents with an xsl file. The issue is when i mouseover the images i need to display the corresponding...
2
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in...
26
by: tjhnson | last post by:
Hi, With properties, attributes and methods seem very similar. I was wondering what techniques people use to give clues to end users as to which 'things' are methods and which are attributes. ...
13
by: lawpoop | last post by:
Hello all - I have a two part question. First of all, I have a website under /home/user/www/. The index.php and all the other website pages are under /home/user/www/. For functions that are...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.