473,511 Members | 16,730 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c# what is the best way to detect OS ?

14 New Member
Hello,
Im trying to detect in my application what OS it is running.

I found this code:

// Get the Operating System From Environment Class
OperatingSystem os = Environment.OSVersion;

// Get the version information
Version vs = os.Version;

MessageBox.Show (vs.Major.ToString());
MessageBox.Show (vs.Minor.ToString());
MessageBox.Show (vs.Revision.ToString());
MessageBox.Show (vs.Build.ToString());


2 questions:

is there a better way to detect OS ? maybe WMI ?
how can I know if its XP 32 or XP 64 ?

Thanks
Nov 11 '07 #1
1 10782
SammyB
807 Recognized Expert Contributor
The Environment class works great. As for 64-bit, OSArchitecture in the WMI class gives you "64-bit" (http://msdn2.microsoft.com/En-US/library/aa394239.aspx), but that's probably not what you want to know. More likely you want to know whether you are running in 64-bit or 32-bit mode regardless of the underlying architecture. In this case, just look at IntPtr.Size. If it is 4, then you are running in 32-bit mode. If it is 8, you are running 64-bit. HTH --Sam
Nov 11 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
3974
by: Stephane Belzile | last post by:
Is there a way I can detect in vb.Net the power has switched to a UPS unit in case of power failure? Thanks
23
6471
by: David McCulloch | last post by:
QUESTION-1: How can I detect if Norton Internet Security is blocking pop-ups? QUESTION-2a: How could I know if a particular JavaScript function has been declared? QUESTION-2b: How could I...
8
2374
by: Brent | last post by:
Does anyone know the best way to detect and track a visitors screen resolution. I know the javascript to detect the users resolution but I am a bit confused on the best way to track and save this....
10
25607
by: Ben Xia | last post by:
Is there some way can detect MAC address with PHP? any help will be appreciate. Ben
1
3175
by: David | last post by:
Hi, I want to detect when a hotkey are pressed. I've installed keyboard global hooks, but in dont know how to detect HotKeys. Some Help ? :) Thanks
3
1815
by: Richard Thornley | last post by:
Hello, I was just been given a project and I have some questions on how to accomplish the first part of the task. If a user sends an email to a specific email address I need to detect...
3
4257
by: Szafranr | last post by:
Hi I have application where I used tcpListener to connect with another system. Every thing is ok that it's time to error handling and I have problem when the TCP client is disconect I don't...
1
6664
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all mister, Which is THE BEST WAY IN THE WORLD AROUND for: 1. detect Network
3
3579
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all mister, Which is THE BEST WAY IN THE WORLD AROUND for: 1. detect Network
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7423
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1576
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
447
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.