Newsgroup: it.comp.appl.access
Titolo: vbA .determinare le versione di windows 8

Utilizzo da tempo questa funzione  tratta dal web e da me modificata 
 
Function fOSName() As String
    Dim osvi             As OSVERSIONINFO
    Dim strOut           As String
 
10    osvi.dwOSVersionInfoSize = Len(osvi)
20    If CBool(apiGetVersionEx(osvi)) Then
30      With osvi
            'Windows 8
40          If .dwPlatformId = VER_PLATFORM_WIN32_NT And _
               .dwMajorVersion = 6 And _
               .dwMinorVersion = 2 Then
50              strOut = "Windows 8 (Version " & _
                         .dwMajorVersion & "." & .dwMinorVersion & _
                         ") Build " & .dwBuildNumber
60              If (Len(.szCSDVersion)) Then
70                  strOut = strOut & " (" & _
                             fTrimNull(.szCSDVersion) & ")"
80              End If
90          End If
 
            'Windows 7
100         If .dwPlatformId = VER_PLATFORM_WIN32_NT And _
               .dwMajorVersion = 6 And _
               .dwMinorVersion = 1 Then
110             strOut = "Windows 7 (Version " & _
                         .dwMajorVersion & "." & .dwMinorVersion & _
                         ") Build " & .dwBuildNumber
120             If (Len(.szCSDVersion)) Then
130                 strOut = strOut & " (" & _
                             fTrimNull(.szCSDVersion) & ")"
140             End If
150         End If
 
            ' Vista
160         If .dwPlatformId = VER_PLATFORM_WIN32_NT And _
               .dwMajorVersion = 6 Then
170             strOut = "Windows Vista (Version " & _
                         .dwMajorVersion & "." & .dwMinorVersion & _
                         ") Build " & .dwBuildNumber
180             If (Len(.szCSDVersion)) Then
190                 strOut = strOut & " (" & _
                             fTrimNull(.szCSDVersion) & ")"
200             End If
210         End If
            ' XP
220         If .dwPlatformId = VER_PLATFORM_WIN32_NT And _
               .dwMajorVersion = 5 And _
               .dwMinorVersion = 1 Then
230             strOut = "Windows XP (Version " & _
                         .dwMajorVersion & "." & .dwMinorVersion & _
                         ") Build " & .dwBuildNumber
240             If (Len(.szCSDVersion)) Then
250                 strOut = strOut & " (" & _
                             fTrimNull(.szCSDVersion) & ")"
260             End If
270         End If
            ' .Net Server
280         If .dwPlatformId = VER_PLATFORM_WIN32_NT And _
               .dwMajorVersion = 5 And _
               .dwMinorVersion = 2 Then
290             strOut = "Windows .NET Server (Version " & _
                         .dwMajorVersion & "." & .dwMinorVersion & _
                         ") Build " & .dwBuildNumber
300             If (Len(.szCSDVersion)) Then
310                 strOut = strOut & " (" & _
                             fTrimNull(.szCSDVersion) & ")"
320             End If
330         End If
            ' Win 2000
340         If .dwPlatformId = VER_PLATFORM_WIN32_NT And _
               .dwMajorVersion = 5 Then
350             strOut = "Windows 2000 (Version " & _
                         .dwMajorVersion & "." & .dwMinorVersion & _
                         ") Build " & .dwBuildNumber
360             If (Len(.szCSDVersion)) Then
370                 strOut = strOut & " (" & _
                             fTrimNull(.szCSDVersion) & ")"
380             End If
390         End If
 
            ' Win ME
400         If (.dwMajorVersion = 4 And _
                (.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS And _
                 .dwMinorVersion = 90)) Then
410             strOut = "Windows Millenium"
420         End If
            ' Win 98
430         If (.dwMajorVersion = 4 And _
                (.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS And _
                 .dwMinorVersion = 10)) Then
440             strOut = "Windows 98"
450         End If
            ' Win 95
460         If (.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS And _
                .dwMinorVersion = 0) Then
470             strOut = "Windows 95"
480         End If
            ' Win NT
490         If (.dwPlatformId = VER_PLATFORM_WIN32_NT And _
                .dwMajorVersion <= 4) Then
500             strOut = "Windows NT " & _
                         .dwMajorVersion & "." & .dwMinorVersion & _
                         " Build " & .dwBuildNumber
510             If (Len(.szCSDVersion)) Then
520                 strOut = strOut & " (" & _
                             fTrimNull(.szCSDVersion) & ")"
530             End If
540         End If
550     End With
560   End If
570   fOSName = strOut
End Function
 
in particolare  ho aggiunto le righe 40 e 50 
per riconoscere windows 8  
probabilmete . dwminorversion  non corrisponde a 2 
 
sapete aiutarmi
 
 
 


RISOLTO 
LA RIGA 160 VA COSì  MODIFICATA
 
160          If .dwPlatformId = VER_PLATFORM_WIN32_NT And _
               .dwMajorVersion = 6 And _
               .dwMinorVersion = 0 Then

 ha scritto nel messaggio 
news:dd3019d2-19ea-476b...@googlegroups.com...

LA RIGA 160 VA COS�  MODIFICATA
 
160          If .dwPlatformId = VER_PLATFORM_WIN32_NT And _
               .dwMajorVersion = 6 And _
               .dwMinorVersion = 0 Then
 
 
Sai Indicare quali Librerie da aggiungere?
 
Saluti
GF
 
 
 

 GF
 
le librerie .. eccole
' ******** 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