1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Windows.Forms;
 
namespace OSVersion
{
    public class OSVersion
    {
        static void Main(string[] args)
        {
            OperatingSystem osInfo = Environment.OSVersion;
            string lTemp = "Version string : " +
                           osInfo.VersionString + 
                           "\r\nOS Name : " + 
                           WinOS.getOSString();
 
            MessageBox.Show(lTemp);
        }
    }
 
 
 
    public static class WinOS
    {
        private static readonly int Unknown = 0;
        private static readonly int Win98 = 1;
        private static readonly int WinME = 2;
        private static readonly int WinNT4 = 3;
        private static readonly int Win2000 = 4;
        private static readonly int WinXP = 5;
        private static readonly int Win2003 = 6;
        private static readonly int WinVista = 7;
        private static readonly int Win7 = 8;
 
        private static int getOS()
        {
            Version o = Environment.OSVersion.Version;
            OperatingSystem osInfo = Environment.OSVersion;
 
 
            if (o.Major == 4 && o.Minor == 10) return Win98;
            if (o.Major == 4 && o.Minor == 90) return WinME;
            if (o.Major == 4 && o.Minor == 0) return WinNT4;
            if (o.Major == 5 && o.Minor == 0) return Win2000;
            if (o.Major == 5 && o.Minor == 1) return WinXP;
            if (o.Major == 5 && o.Minor == 2) return Win2003;
            if (o.Major == 6 && o.Minor == 0) return WinVista;
            if (o.Major == 6 && o.Minor == 1) return Win7;
            return Unknown;
        }
 
 
 
        public static String getOSString()
        {
            switch (WinOS.getOS())
            {
                case 1: return "Windows 98";
                case 2: return "Windows ME";
                case 3: return "Windows NT4";
                case 4: return "Windows 2000";
                case 5: return "Windows XP";
                case 6: return "Windows 2003 Server";
                case 7: return "Windows Vista";
                case 8: return "Windows 7";
                default: return "Unbekannt";
            }
        }
 
 
 
        public static String getSP()
        {
            return Environment.OSVersion.ServicePack;
        }
    }
 
}


carrumba says:

according Raymond Chen you can check it like this :

BOOL Is64BitWindows()
{
#if defined(_WIN64)
return TRUE; // 64-bit programs run only on Win64
#elif defined(_WIN32)
// 32-bit programs run on both 32-bit and 64-bit Windows
// so must sniff
BOOL f64 = FALSE;
return IsWow64Process(GetCurrentProcess(), &f64) && f64;
#else
return FALSE; // Win64 does not support Win16
#endif

(http://blogs.msdn.com/b/oldnewthing/archive/2005/02/01/364563.aspx)
}

Mario says:

Hi,
und wie sehe ich ob x64 oder x86 das ganze ist ?
Danke
Mario