???-?? 32-??? Windows ?? ??????? ?? ????? ???? ?? ??? ?? ?? ???????? ???? ????

???? ?????? ???? ??????
???? ID: 189249 - ?? ???????? ?? ?????? ??? ?? ?? ???? ???? ???? ??.
??? ?? ??????? ???? | ??? ?? ??????? ????

?? ????? ??

??????

??? ????????? differently ??? ?? ???????? ?????? ?? ???????? ?? ?? ??? ?? ?? ?????? ??????? ?? ???? ?? ??? ?? ???????? ?? ???? ??? ?? ???? ??????, ?????? ?? ???, ?? Microsoft Windows 95, Microsoft Windows 98, Microsoft ????? NT 3.51, Microsoft Windows NT 4.0, Microsoft Windows 2000, ?? Microsoft Windows XP ?? ??? differentiate ???? ?????

Win32GetVersionEx??????? ???????? ?????? ?? ??????? ?? ??? ???? ????????? ?? ????? ?? ???? ??? ?? ??????? ???? ??? ?? ????? ?? ??? ??? ?? ???? ?????????? ??????? ?? ?? ?????????? ?????????? ??? Windows 98 ?? ????? ?? ?? ???? Windows ?? ??? ?? ??????? ????? ??? ?? ?? ???????? ???? ?? ??? ???? ????? ??????? ?????????? ???? ?? ?? ???? ?? ????????? OSVERSIONINFO ?????? ?? ????????? ???? ?? ??? ?????? ???? ?????? ????? ??GetVersionEx?????? ?? ??? ???? ???.:
?? ?????? ?? ??????? ?????? ?????? ?? ??????? ????
Windows 95Windows 98Windows MeWindows NT 4.0Windows 2000:Windows XP
PlatformID111222
????? ???????444455
?? ???????01090001

???? ???????

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

  1. Visual Basic ??? ?? ?? ???? EXE ????????? ??????? ????? Form1 ???????? ??? ?? ???? ??..
  2. ??????????????? ?? ???, ????? ??????? ?????????????????
  3. ??? ????? ??? ???????? ????Module1:
          Public Declare Function GetVersionExA Lib "kernel32" _
                   (lpVersionInformation As OSVERSIONINFO) As Integer
     
                Public Type OSVERSIONINFO
                   dwOSVersionInfoSize As Long
                   dwMajorVersion As Long
                   dwMinorVersion As Long
                   dwBuildNumber As Long
                   dwPlatformId As Long
                   szCSDVersion As String * 128
                End Type
     
                Public Function getVersion() As String
                   Dim osinfo As OSVERSIONINFO
                   Dim retvalue As Integer
     
                   osinfo.dwOSVersionInfoSize = 148
                   osinfo.szCSDVersion = Space$(128)
                   retvalue = GetVersionExA(osinfo)
     
                   With osinfo
                   Select Case .dwPlatformId
     
                    Case 1
                    
                        Select Case .dwMinorVersion
                            Case 0
                                getVersion = "Windows 95"
                            Case 10
                                getVersion = "Windows 98"
                            Case 90
                                getVersion = "Windows Millennium"
                        End Select
        
                    Case 2
                        Select Case .dwMajorVersion
                            Case 3
                                getVersion = "Windows NT 3.51"
                            Case 4
                                getVersion = "Windows NT 4.0"
                            Case 5
                                If .dwMinorVersion = 0 Then
                                    getVersion = "Windows 2000"
                                Else
                                    getVersion = "Windows XP"
                                End If
                        End Select
        
                    Case Else
                       getVersion = "Failed"
                End Select
     
                   End With
                End Function
    
    					
  4. ??? ?? ????? ?????? ????????? ????Form1 ?????:
    MsgBox GetVersion()
    					
  5. ????????? ?? ?????, ?? ??? ???? ?? ??? ????? ????? Windows ?? ??? ??????? ????????? ???? ???

??????

???????? ??????? ?? ???, Microsoft ?????? ??? ??? ???? ????? ?? ??? ????? ???? ?????? ????? ????::
92936GetVersion ?? ??? VB ??? Windows 3.1 ??????? ?????? ?? ??????? ???? ?? ??? ???? ????

???

???? ID: 189249 - ????? ???????: 03 ?????? 2010 - ??????: 4.0
???? ???? ???? ??:
  • Microsoft Visual Basic 5.0 Learning Edition
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
  • Microsoft Visual Basic 4.0 Standard Edition
??????: 
kbhowto kbmt KB189249 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:189249

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

 

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