Strona: [  << <   1   > >>  ]  z  1     
Autor Temat: Jak za pomoca VB pobrac wersje windowsa wraz z SP??
axe




Typ: neutral
Postów: 1
Zarejestrowany: Oct 2003
Jak za pomoca VB pobrac wersje windowsa wraz z SP??

No wlasnie, jak? Nie chodzi mi o wynik typu 5.0.2195 tylko zeby pieknie ladnie napisal
"Windows 2000 Service Pack 3". Moze ktos pomoc? Potrzebne na wczoraj.

08-10-2003 09:26
Pokaż profil axe  Wyślij email do axe   
anonim




Typ: Nie zarejestrowany

Z resjestru kolezko.

08-10-2003 09:36
  
koala



Typ: neutral
Postów: 9
Zarejestrowany: Nov 2003

Pokombinu z tym powinno pomóc:

Private Type OSVERSIONINFO
  dwOSVersionInfoSize As Long
  dwMajorVersion As Long
  dwMinorVersion As Long
  dwBuildNumber As Long
  dwPlatformId As Long
  szCSDVersion As String * 128      '  Maintenance string for PSS usage
End Type

Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (ByRef lpVersionInformation As OSVERSIONINFO) As Long

Private Sub Form_Load
  Dim OS as OSVERSIONINFO
  Dim X as Long

  OS.dwOSVersionInfoSize = Len(OS)
  X = GetVersionEx(OS)
  MsgBox Replace(OS.szCSDVersion, Chr(0), ""
End Sub

13-11-2003 14:00
Pokaż profil koala  Wyślij email do koala        1333014
Knight Lore''FC




Typ: neutral
Postów: 240
Zarejestrowany: Jan 2003

koala troche to okroił ... przyklad pochodzi z API-Guide :

Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long

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 Sub Form_Load()
    Dim OSInfo As OSVERSIONINFO, PId As String

    Me.AutoRedraw = True

    OSInfo.dwOSVersionInfoSize = Len(OSInfo)
    Ret& = GetVersionEx(OSInfo)

    If Ret& = 0 Then MsgBox "Error Getting Version Information": Exit Sub

    Select Case OSInfo.dwPlatformId
        Case 0
            PId = "Windows 32s "
        Case 1
            PId = "Windows 95/98"
        Case 2
            PId = "Windows NT "
    End Select

    Print "OS: " + PId
    Print "Win version:" + str$(OSInfo.dwMajorVersion) + "." + LTrim(str(OSInfo.dwMinorVersion))+ " " + Replace(OSInfo.szCSDVersion, Chr$(0), "" )
    Print "Build: " + str(OSInfo.dwBuildNumber)

End Sub

Trzeba by jeszcze sprawdzic co zwraca OSInfo.dwPlatformId w przypadku 2000 i XP ...
no i pozostal jeszcze Revision... - sprawdze to

[Post edytowany dnia 18-11-2003 11:09 przez Knight Lore'FC]

18-11-2003 11:01
Pokaż profil Knight Lore  Wyślij email do Knight Lore        1065423
Knight Lore''FC




Typ: neutral
Postów: 240
Zarejestrowany: Jan 2003

Doszperalem sie troche dalej innego przykladu i zmontowalem 2 w jeden - uzupelnia dane o system operacyjny (nie tylko platforma)

Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long

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 Sub Form_Load()
   
    Dim OSInfo As OSVERSIONINFO, PId As String, SId As String
   
    Me.AutoRedraw = True

    OSInfo.dwOSVersionInfoSize = Len(OSInfo)
    Ret& = GetVersionEx(OSInfo)

    If Ret& = 0 Then MsgBox "Error Getting Version Information": Exit Sub

    Select Case OSInfo.dwPlatformId
        Case 0
            PId = "Windows 32s "
                    SId = "Windows 32"
        Case 1
            PId = "Windows 95/98"
                If OSInfo.dwMinorVersion = 0 Then
                    SId = "Windows 95"
                ElseIf OSInfo.dwMinorVersion = 10 Then
                    SId = "Windows 98"
                ElseIf OSInfo.dwMinorVersion = 90 Then
                    SId = "Windows Me"
                End If
        Case 2
            PId = "Windows NT/2000/XP"
                If OSInfo.dwMajorVersion < 5 Then
                    SId = "Windows NT"
                ElseIf OSInfo.dwMajorVersion = 5 And OSInfo.dwMinorVersion = 0 Then
                    SId = "Windows 2000"
                ElseIf OSInfo.dwMajorVersion = 5 And OSInfo.dwMinorVersion = 1 Then
                    SId = "Windows XP"
                End If
    End Select
       
    Print "Operating Platform: " + PId
    Print "Operating System: " + SId
    Print "Win version: " + LTrim(Str$(OSInfo.dwMajorVersion)) + "." + LTrim(Str(OSInfo.dwMinorVersion)) + " " + Replace(OSInfo.szCSDVersion, Chr$(0), "" )
    Print "Build: " + LTrim(Str(OSInfo.dwBuildNumber))

End Sub

Co do Revision to jeszcze szukam....

18-11-2003 11:44
Pokaż profil Knight Lore  Wyślij email do Knight Lore        1065423
Wszystkich odpowiedzi: 4 :: Maxymalnie na stronę: 20
Strona: [  << <   1   > >>  ]  z  1