Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Make the programs work on a specific windows version

0.00/5 (No votes)
27 Sep 2010 1  
C#
private void Form1_Load(object sender, EventArgs e)
{
    if (!IsWin7())
    {
        Application.Exit();
    }
}
bool IsWin7()
{
    return Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 1;
}
bool IsWinVista()
{
    return Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 0;
}


others windows versions:
Server 2008 R2
Major=6
Minor=1

Server 2008
Major=6
Minor=0

Server 2003
5
2

XP
5
1

2000
5
0

NT4
4
0

ME
4
90

98
4
10

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here