How to get current user login time by Registry key


The Registry key to get current user name is like below. What is the registry path to get current user login time??Any help?? Thanks~

Private Sub GetCurrentLoginName()
Dim reg As RegistryKey 'the reg key
Dim subKeyName As String 'key names
reg = Registry.Users

If Not reg Is Nothing Then 'check maybe keys does not exists
For Each subKeyName In reg.GetSubKeyNames
reg = Registry.Users.OpenSubKey(subKeyName & "SoftwareMicrosoftWindowsCurrentVersionExplorer", False) 'open the subkey
If Not reg Is Nothing Then 'check
If reg.GetValue("Logon User Name", Nothing) Is Nothing Then 'read
'no user found in this subkey
loginName = "Login Name: " & CType(reg.GetValue("Logon User Name", Nothing), String)
End If
End If
End If
End Sub
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!