Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Windows version
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00996554
Message ID:
00996943
Views:
23
I hate challenges - I have to search for the solution until I find it. Sometimes that means staying up 1/2 the night or waking up early to figure it out...

Here at work we actually use a struct and assign the values using Win32 API. I hate it!!!

I did find WQL, though - and here's the code.
using System.Management;

...

SelectQuery q = new SelectQuery("Win32_OperatingSystem");
ManagementObjectSearcher s = new ManagementObjectSearcher(q);

foreach(ManagementObject mo in s.get())
{
    Console.WriteLine(mo["ServicePackMajorVersion"]);
{
It isn't much cleaner than using Win32Api but at least you're staying withing the managed code which is what M$ would like to see - plus it would make your upgrade a lot easier when new .NET Framework versions are released.

Enjoy! I'm going back to bed...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform