Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Installation Date Call?

Status
Not open for further replies.
Get Windows Version

Module Code
Public Type OSVERSIONINFOEX
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type

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

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

Form Code
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
sAns = "Windows 2000"
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"
Else
sAns = "Windows 3.x"
End If

Case Else
sAns = "Unknown Windows Version"
End Select

OSVersion = sAns

End Function

Private Sub Form_Load()
MsgBox "Windows version detected: " & OSVersion
End Sub


Eric De Decker
vbg.be@vbgroup.nl

Licence And Copy Protection AxtiveX.

Download Demo version on my Site:
Promotions before 02/28/2001 (free source codebook),visite my site
 
I checked my registry (WinNT 4.0) and did not find any key/data with the phrase "Installed Date". Are you sure that the key you found was not installed by some other application?
Anyway, with that being said, here is how I would determine the installation date of the OS. First, I would find the windows directory (i.e. C:\Winnt). Then I would check the creation date of that folder. That date (assuming that the windows folder was created when the OS was installed) should be that installation date of the OS.
edderic does provide you with valid code to find the OS version, but you sould not need that to determine the installation date of the OS.
The API to get the Windows folder is as follows . . .


Public Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long


If you want any more help on this, just let me know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top