![]() |
Wie installations datum von windows ermittlen ?
wie bekomme ich raus wann Windows installiert wurde ??
welches datum und uhrzeit ? |
Re: Wie installations datum von windows ermittlen ?
hi,
du könntest dias Erstelldatum/-uhrzeit von dem Windows Standardordner auslesen, der wird ja bei der Installation erstellt. Eventuell gibts einen speziellen Registryeintrag, aber dazu weiss ich nichts. cu, stefan2005 |
Re: Wie installations datum von windows ermittlen ?
Windows NT:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion InstallDate (REG_DWORD) -> SecondsSince1970 Windows 9x: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion FirstInstallDateTime (?) -> ? |
Re: Wie installations datum von windows ermittlen ?
gibt es dann auch eine funktion die dieses 'SecondsSince1970' in ein datum/uhrzeit umwandlen kann ?
|
Re: Wie installations datum von windows ermittlen ?
Bei mir heißt diese Funktion DateUtils.UnixToDateTime().
marabu |
Re: Wie installations datum von windows ermittlen ?
Nachtrag für Win9x (ab Win95, erste Version, ohne Updates)
Delphi-Quellcode:
Viel Spass ;)
function GetWindowsInstallDateTime: TDateTime;
const RegKeyNT = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion'; RegValNT = 'InstallDate'; RegKey95 = 'SOFTWARE\Microsoft\Windows\CurrentVersion'; RegVal95 = 'FirstInstallDateTime'; function RegReadDWORD(const Key, Name: string): DWORD; begin Result := 0; with TRegistry.Create do try RootKey := HKEY_LOCAL_MACHINE; if KeyExists(Key) and OpenKeyReadOnly(Key) and ValueExists(Name) and (GetDataType(Name) in [rdInteger, rdBinary, rdUnknown]) and (GetDataSize(Name) = SizeOf(Result)) then if GetDataType(Name) = rdInteger then Result := DWORD(ReadInteger(Name)) else ReadBinaryData(Name, Result, SizeOf(Result)); finally Free; end; end; var Value: DWORD; begin Value := RegReadDWORD(RegKeyNT, RegValNT); if Value <> 0 then Result := EncodeDate(1970, 1, 1) + (Value / SecsPerDay) else begin Value := RegReadDWORD(RegKey95, RegVal95); if Value <> 0 then Result := FileDateToDateTime(Value) else Result := 0.0; end; end; //////////////////////////////////////////////////////////////////////////////// // Beispiel procedure TForm1.Button1Click(Sender: TObject); begin ShowMessage(FormatDateTime('yyyy-mm-dd hh:nn:ss', GetWindowsInstallDateTime)); end; |
Re: Wie installations datum von windows ermittlen ?
vielen dank fur dass beispiel.....
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:53 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz