Function Reference


_WinAPI_RegQueryLastWriteTime

Retrieves information about the last write time to the specified registry key

#include <WinAPIReg.au3>
_WinAPI_RegQueryLastWriteTime ( $hKey )

Parameters

$hKey Handle to an open registry key. The key must have been opened with the $KEY_QUERY_VALUE access right.
This handle is returned by the _WinAPI_RegCreateKey() or _WinAPI_RegOpenKey() function. It can also
be one of the following predefined keys.
$HKEY_CLASSES_ROOT
$HKEY_CURRENT_CONFIG
$HKEY_CURRENT_USER
$HKEY_LOCAL_MACHINE
$HKEY_PERFORMANCE_DATA
$HKEY_USERS

Return Value

Success: $tagFILETIME structure that contains the last write time.
Failure: Sets the @error flag to non-zero, @extended flag may contain the system error code.

Related

_WinAPI_RegCreateKey, _WinAPI_RegOpenKey

See Also

Search RegQueryInfoKey in MSDN Library.

Example

#include <APIRegConstants.au3>
#include <Date.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIError.au3>
#include <WinAPILocale.au3>
#include <WinAPIReg.au3>

; X64 running support
Local $sWow64 = ""
If @AutoItX64 Then $sWow64 = "\Wow6432Node"

Local $hKey = _WinAPI_RegOpenKey($HKEY_LOCAL_MACHINE, 'SOFTWARE' & $sWow64 & '\AutoIt v3\AutoIt', $KEY_QUERY_VALUE)
If @error Then
    MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), @extended, _WinAPI_GetErrorMessage(@extended))
    Exit
EndIf

Local $tFT = _WinAPI_RegQueryLastWriteTime($hKey)
$tFT = _Date_Time_FileTimeToLocalFileTime($tFT)
Local $tST = _Date_Time_FileTimeToSystemTime($tFT)
_WinAPI_RegCloseKey($hKey)

ConsoleWrite('!Last modified at: ' & _WinAPI_GetDateFormat(0, $tST) & ' ' & _WinAPI_GetTimeFormat(0, $tST) & @CRLF)