LEADERSOFT.ru Разработка на заказ программ и сайтов
Форумы по информационным технологиям
 
Регистрация  |  Вход
left
Форумы Минимизировать
ПоискСписок форумов
  Программирование  Microsoft Access. Файлы mdb и accdb  FAQ\Api Не могу...
 FAQ\Api Не могу определить Vista из api
 
 29.11.2007 10:23:48
All
4316 сообщения
1-ый


FAQ\Api Не могу определить Vista из api
 Измененный All  на 29.11.2007 10:59:49)

Я видел код, который определяет операционную систему. Например, http://www.mvps.org/access/api/api0055.htm
Однако он не определяет Vista. Есть решения?

Вот дополнительное решение:

'=========================
Option Compare Database

' ******** Code Start ********
 'This code was originally written by Dev Ashish.
 'It is not to be altered or distributed,
 'except as part of an application.
 'You are free to use it in any application,
 'provided the copyright notice is left unchanged.
 '
 'Code Courtesy of
 'Dev Ashish
 '

Private Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
End Type

Private Declare Function apiGetVersionEx Lib "kernel32" _
    Alias "GetVersionExA" _
    (lpVersionInformation As Any) _
    As Long

Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32_NT = 2

'==================================================

Function fOSName() As String
Dim osvi As OSVERSIONINFO
Dim strOut As String
Dim strCSDVersion As String

    osvi.dwOSVersionInfoSize = Len(osvi)
    If CBool(apiGetVersionEx(osvi)) Then
        With osvi

            strCSDVersion = fTrimNull(.szCSDVersion)
            ' Win 2000
            If .dwPlatformId = VER_PLATFORM_WIN32_NT And _
                .dwMajorVersion = 5 Then
                    strOut = "Windows 2000 (Version " & _
                        .dwMajorVersion & "." & .dwMinorVersion & _
                        ") Build " & .dwBuildNumber
                    If (Len(.szCSDVersion)) Then
                        strOut = strOut & " (" & _
                                    fTrimNull(.szCSDVersion) & ")"
                    End If
            End If
            ' XP
            If .dwPlatformId = VER_PLATFORM_WIN32_NT And _
                .dwMajorVersion = 5 And _
                .dwMinorVersion = 1 Then
                    strOut = "Windows XP (Version " & _
                        .dwMajorVersion & "." & .dwMinorVersion & _
                        ") Build " & .dwBuildNumber
                    If (Len(.szCSDVersion)) Then
                        strOut = strOut & " (" & _
                                    fTrimNull(.szCSDVersion) & ")"
                    End If
            End If
            ' .Net Server
            If .dwPlatformId = VER_PLATFORM_WIN32_NT And _
                .dwMajorVersion = 5 And _
                .dwMinorVersion = 2 Then
                    strOut = "Windows .NET Server (Version " & _
                        .dwMajorVersion & "." & .dwMinorVersion & _
                        ") Build " & .dwBuildNumber
                    If (Len(.szCSDVersion)) Then
                        strOut = strOut & " (" & _
                                    fTrimNull(.szCSDVersion) & ")"
                    End If
            End If
            ' Win ME
            If (.dwMajorVersion = 4 And _
                (.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS And _
                .dwMinorVersion = 90)) Then
                    strOut = "Windows Millenium"
            End If
            ' Win 98
            If (.dwMajorVersion = 4 And _
                (.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS And _
                .dwMinorVersion = 10)) Then
                    strOut = "Windows 98"
            End If
            ' Win 95
            If (.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS And _
                .dwMinorVersion = 0) Then
                    strOut = "Windows 95"
            End If
            ' Win NT
            If (.dwPlatformId = VER_PLATFORM_WIN32_NT And _
                .dwMajorVersion <= 4) Then
                strOut = "Windows NT " & _
                        .dwMajorVersion & "." & .dwMinorVersion & _
                        " Build " & .dwBuildNumber
                If (Len(.szCSDVersion)) Then
                        strOut = strOut & " (" & _
                                    fTrimNull(.szCSDVersion) & ")"
                End If
'*************************************************************************
            ' Vista
            If .dwPlatformId = VER_PLATFORM_WIN32_NT And _
                .dwMajorVersion = 6 And _
                .dwMinorVersion = 0 Then
                    strOut = "Windows Vista (Version " & _
                        .dwMajorVersion & "." & .dwMinorVersion & _
                        ") Build " & .dwBuildNumber & strCSDVersion
                If (Len(strCSDVersion)) Then
                    strCSDVersion = " (" & strCSDVersion & ")"
                End If
            End If
'*************************************************************************
            End If
        End With
    End If
    fOSName = strOut
End Function

'==================================================

Private Function fTrimNull(strIn As String) As String
Dim intPos As Integer
    intPos = InStr(1, strIn, vbNullChar)
    If intPos Then
        fTrimNull = Mid$(strIn, 1, intPos - 1)
    Else
        fTrimNull = strIn
    End If
End Function
'   ********** Code End **********
'=========================
Источник: http://groups.google.com/group/microsoft.public.access/browse_thread/thread/2f28e0eab90a828d?hl=en

  Программирование  Microsoft Access. Файлы mdb и accdb  FAQ\Api Не могу...
ПоискПоиск  Список форумовСписок форумов  
right