Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Windows version
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
00996554
Message ID:
00996943
Vues:
24
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...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform