/ Forside / Teknologi / Udvikling / VB/Basic / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
VB/Basic
#NavnPoint
berpox 2425
pete 1435
CADmageren 1251
gibson 1230
Phylock 887
gandalf 836
AntonV 790
strarup 750
Benjamin... 700
10  tom.kise 610
Hvilket operativ system ?
Fra : VIP


Dato : 22-12-03 22:54

hvordan kan jeg fra mit program se hvilket operativ system XP, 2000, 98 ,Me,
95, der kører på maskinen ?

--
Venlig hilsen

Viggo
Erstat "punktum" med . i email adresse



 
 
webmaster (22-12-2003)
Kommentar
Fra : webmaster


Dato : 22-12-03 23:11


"VIP" <netbroker@mail punktum dk> skrev i en meddelelse
news:3fe76841$0$151$edfadb0f@dtext02.news.tele.dk...
> hvordan kan jeg fra mit program se hvilket operativ system XP, 2000, 98
,Me,
> 95, der kører på maskinen ?
>

Denne virker ihvertfald også med XP:


Option Explicit

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

Private Const VER_PLATFORM_WIN32s = 0
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32_NT = 2

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



Public Function OSVersion() As String

Dim udtOSVersion As OSVERSIONINFOEX
Dim lMajorVersion As Long
Dim lMinorVersion As Long
Dim lPlatformID As Long
Dim sAns As String


udtOSVersion.dwOSVersionInfoSize = Len(udtOSVersion)
GetVersionEx udtOSVersion
lMajorVersion = udtOSVersion.dwMajorVersion
lMinorVersion = udtOSVersion.dwMinorVersion
lPlatformID = udtOSVersion.dwPlatformId

Select Case lMajorVersion
Case 5

' Added the following to give suppport for Windows XP!
If lMinorVersion = 0 Then

sAns = "Windows 2000"

ElseIf lMinorVersion = 1 Then

sAns = "Windows XP"

End If



Case 4
If lPlatformID = VER_PLATFORM_WIN32_NT Then
sAns = "Windows NT 4.0"
Else
sAns = IIf(lMinorVersion = 0, _
"Windows 95", "Windows 98")
End If
Case 3
If lPlatformID = VER_PLATFORM_WIN32_NT Then
sAns = "Windows NT 3.x"

'below should only happen if person has Win32s
'installed
Else
sAns = "Windows 3.x"
End If

Case Else
sAns = "Unknown Windows Version"
End Select

OSVersion = sAns

End Function

mvh.

- Arne.



Tim Sørensen (23-12-2003)
Kommentar
Fra : Tim Sørensen


Dato : 23-12-03 07:40

"webmaster" <via@hjemmeside.dk> wrote
> Public Function OSVersion() As String

Dejlig funktion

--
Mvh.... Tim Sørensen
http://www.dondata.dk/



VIP (24-12-2003)
Kommentar
Fra : VIP


Dato : 24-12-03 00:18

Tak for hjælpen, det ser ud til at virke

--
Venlig hilsen

Viggo
Erstat "punktum" med . i email adresse
"webmaster" <via@hjemmeside.dk> skrev i en meddelelse
news:bs7qas$75p$1@sunsite.dk...
>
> "VIP" <netbroker@mail punktum dk> skrev i en meddelelse
> news:3fe76841$0$151$edfadb0f@dtext02.news.tele.dk...
> > hvordan kan jeg fra mit program se hvilket operativ system XP, 2000, 98
> ,Me,
> > 95, der kører på maskinen ?
> >
>
> Denne virker ihvertfald også med XP:
>
>
> Option Explicit
>
> Private Type OSVERSIONINFOEX
> dwOSVersionInfoSize As Long
> dwMajorVersion As Long
> dwMinorVersion As Long
> dwBuildNumber As Long
> dwPlatformId As Long
> szCSDVersion As String * 128
> End Type
>
> Private Const VER_PLATFORM_WIN32s = 0
> Private Const VER_PLATFORM_WIN32_WINDOWS = 1
> Private Const VER_PLATFORM_WIN32_NT = 2
>
> Private Declare Function GetVersionEx Lib "kernel32" _
> Alias "GetVersionExA" (lpVersionInformation As _
> OSVERSIONINFOEX) As Long
>
>
>
> Public Function OSVersion() As String
>
> Dim udtOSVersion As OSVERSIONINFOEX
> Dim lMajorVersion As Long
> Dim lMinorVersion As Long
> Dim lPlatformID As Long
> Dim sAns As String
>
>
> udtOSVersion.dwOSVersionInfoSize = Len(udtOSVersion)
> GetVersionEx udtOSVersion
> lMajorVersion = udtOSVersion.dwMajorVersion
> lMinorVersion = udtOSVersion.dwMinorVersion
> lPlatformID = udtOSVersion.dwPlatformId
>
> Select Case lMajorVersion
> Case 5
>
> ' Added the following to give suppport for Windows XP!
> If lMinorVersion = 0 Then
>
> sAns = "Windows 2000"
>
> ElseIf lMinorVersion = 1 Then
>
> sAns = "Windows XP"
>
> End If
>
>
>
> Case 4
> If lPlatformID = VER_PLATFORM_WIN32_NT Then
> sAns = "Windows NT 4.0"
> Else
> sAns = IIf(lMinorVersion = 0, _
> "Windows 95", "Windows 98")
> End If
> Case 3
> If lPlatformID = VER_PLATFORM_WIN32_NT Then
> sAns = "Windows NT 3.x"
>
> 'below should only happen if person has Win32s
> 'installed
> Else
> sAns = "Windows 3.x"
> End If
>
> Case Else
> sAns = "Unknown Windows Version"
> End Select
>
> OSVersion = sAns
>
> End Function
>
> mvh.
>
> - Arne.
>
>



Søg
Reklame
Statistik
Spørgsmål : 177557
Tips : 31968
Nyheder : 719565
Indlæg : 6408878
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste