????? ????? ????? Windows ???????? Visual C#

?????? ????????? ?????? ?????????
???? ???????: 304283 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

???? ??? ??????? ???? ????? ??? ????? ????? ???? ??????? ??? ??????? ??? ?????? ??? ??? ????? ??????? ????? ??. ???? ??? ??????? ??? ???? ??????? Microsoft Windows 95 ? Microsoft Windows 98 ? ??????? ?????? ?? Microsoft Windows 98 ? Microsoft Windows Millennium Edition (Windows Me) ? Microsoft Windows NT 3.51 ? Microsoft Windows NT 4.0 ? Microsoft Windows 2000 ? Windows XP.

???????

  • Microsoft Visual C# .NET
  • Microsoft Visual C# 2005 ?? Visual C# 2008
  • ?????? ?? ??? ????? ????? Visual C#

?????? ??? ?????? ??????? Windows

?????? ???? ??????? ???? ???? ??? ???? ??? ?????? ??? ???????? ???????:
+--------------------------------------------------------------+
|           |Windows|Windows|Windows|Windows NT|Windows|Windows|
|           |  95   |  98   |  Me   |    4.0   | 2000  |  XP   |
+--------------------------------------------------------------+
|PlatformID | 1     | 1     | 1     | 2        | 2     | 2     |
+--------------------------------------------------------------+
|Major      |       |       |       |          |       |       |
| version   | 4     | 4     | 4     | 4        | 5     | 5     |
+--------------------------------------------------------------+
|Minor      |       |       |       |          |       |       |
| version   | 0     | 10    | 90    | 0        | 0     | 1     |
+--------------------------------------------------------------+
				
??????: ????? ?????? ?? ????????? ???????? ?? ??? ??????? ????????? ?? ???? ????????? 32-?? ?? Windows Windows 95 ? Windows NT 3.51 ?? ???? Microsoft Visual Studio .NET ?? ??? ????? ????? ??????.

?????? ??? ??????? ???? ???????

????? ??? ?????? ????? ??? ??? ??????? OperatingSystem. ???? ??????? ???? OperatingSystem ????????? ???????? ??? ???? ??????? ??? ?????????. ????? ????? OSVersion ??? System.Environment ???? OperatingSystem.
    System.OperatingSystem osInfo = System.Environment.OSVersion;
				

????? ?????? ???????

?????? ?????? ?? ????? ???????? ????????? OperatingSystem ????? ?????? ??????? ???? ?? ??? ?????????. ????? ??????? ????? PlatformID ??? OperatingSystem ????? ?????? ??????? ???? ?? ??? ?????????.

??? ???? ??????? ???? ???? ????? ????? ??????? Win32Windows ??? ??? ????? ??????? ???????:
  • Windows 95
  • ???? ??????? Windows 98
  • ??????? ?????? ?? Windows 98
  • Windows Me
????? ?????? ??????? WinNT ??? ??? ????? ??????? ???????:
  • Windows NT 3.51
  • Windows NT 4.0
  • ???? ??????? Windows 2000
  • Windows XP
    switch(osInfo.Platform)
        {
            case System.PlatformID.Win32Windows:         
                {
                 // Code to determine specific version of Windows 95, 
                 // Windows 98, Windows 98 Second Edition, or Windows Me.
                }

           case System.PlatformID.Win32NT:
               {
                  // Code to determine specific version of Windows NT 3.51, 
                  // Windows NT 4.0, Windows 2000, or Windows XP.
               }
           
         }
				

????? ????? ???? ?? Windows 95 ?? Windows 98 ??????? ?????? ?? Windows 98 ?? Windows Me

??? ???? ?? ?????? ??????? ?? Windows 95 ?? Windows 98 ? ??????? ?????? ?? Windows 98 ?? Windows Me ????? ????? ?? ??????? ?? ????? ????? ?????? ????? ????.
    // Platform is Windows 95, Windows 98, Windows 98 Second Edition,
    // or Windows Me.
    case System.PlatformID.Win32Windows:
         
    switch (osInfo.Version.Minor)
        {
            case 0:
                Console.WriteLine ("Windows 95");
                break;
            case 10:
                if(osInfo.Version.Revision.ToString()=="2222A")
                    Console.WriteLine("Windows 98 Second Edition");
                else
                     Console.WriteLine("Windows 98");
                     break;
            case  90:
                     Console.WriteLine("Windows Me");
                     break;
         }break;
				

????? ????? ???? ?? Windows NT ?? Windows 2000 ?? Windows XP

??? ???? ?? ?????? ??????? ?? Windows NT 3.51 ?? Windows NT 4.0, Windows 2000 ?? Windows XP ????? ????? ?? ??????? ?? ????? ????? ?????? ????? ????.
    // Platform is Windows NT 3.51, Windows NT 4.0, Windows 2000,
    // or Windows XP.
    case System.PlatformID.Win32NT:

    switch(osInfo.Version.Major)
        {
            case 3:
                Console.WriteLine("Windows NT 3.51");
                break;
            case 4:
                Console.WriteLine("Windows NT 4.0");
                break;
            case 5:
                if (osInfo.Version.Minor==0) 
                    Console.WriteLine("Windows 2000");
                else
                    Console.WriteLine("Windows XP");
                    break;
         }break;
				

????? ?? ?????

????? ??????? ??????? ??????? ?????? ???? ??? ?????? ???????:
  1. ?? Visual Studio .NET ? ???? C# ???? ????? ????. ??? ???? ????????? ???????? Class1.cs ???? ???????.

    ?????? ?? Visual Studio 2005 ?? ?? 2008 Visual Studio ????? ????????? ?? Program.cs. ????? ????? ????? ??????? ??? Program.cs ??? ??? ???? ????????? ????????.
  2. ??????? ???? ????????? ???????? ?? ???? ???? ????????? ???????? Class1.cs ?? ????? ????????? ???????? ??????:
    using System;
    
    namespace determineOS_CS
    {  
    class Class1
       {
          static void Main(string[] args)
          {
             // Get OperatingSystem information from the system namespace.
             System.OperatingSystem osInfo =System.Environment.OSVersion;
             
             // Determine the platform.
             switch(osInfo.Platform)
             {
                // Platform is Windows 95, Windows 98, 
                // Windows 98 Second Edition, or Windows Me.
                case System.PlatformID.Win32Windows:
             
                   switch (osInfo.Version.Minor)
                   {
                      case 0:
                         Console.WriteLine ("Windows 95");
                         break;
                      case 10:
                         if(osInfo.Version.Revision.ToString()=="2222A")
                            Console.WriteLine("Windows 98 Second Edition");
                         else
                            Console.WriteLine("Windows 98");
                         break;
                      case  90:
                         Console.WriteLine("Windows Me");
                         break;
                   }
                   break;
             
                // Platform is Windows NT 3.51, Windows NT 4.0, Windows 2000,
                // or Windows XP.
                case System.PlatformID.Win32NT:
    
                   switch(osInfo.Version.Major)
    
                   {
                      case 3:
                         Console.WriteLine("Windows NT 3.51");
                         break;
                      case 4:
                         Console.WriteLine("Windows NT 4.0");
                         break;
                      case 5:
                         if (osInfo.Version.Minor==0) 
                            Console.WriteLine("Windows 2000");
                         else
                            Console.WriteLine("Windows XP");
                         break;
                   }break;
             }
             Console.ReadLine ();
          }
       }
    }
    					
  3. ???? CTRL + F5 ?????? ???????. ???? ?? ????? Windows ???? ?? ???? ???? ??????.

???????

???? ???????: 304283 - ????? ??? ??????: 12/???/1429 - ??????: 3.0
????? ???
  • Microsoft Visual C# .NET 2002 Standard Edition
  • Microsoft Visual C# 2005
  • Microsoft Visual C# 2008 Express Edition
????? ??????: 
kbmt kbhowtomaster kbprod2web KB304283 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????304283

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com