General information
Category:
Coding, syntax & commands
try this code
Public usernm As String
Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" _
(ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, _
ByRef lpType As Long, ByVal szData As String, ByRef lpcbData As Long) As Long
Sub username()
Dim szBuffer As String, dataBuff As String, ldataBuffSize As Long, _
hKey As Long, phkResult As Long, RetVal As Long, _
Value As String, RegEnumIndex As Long
'Create Buffer
dataBuff = Space(255)
ldataBuffSize = Len(dataBuff)
szBuffer = ".Default\Software\Microsoft\MS Setup (ACME)\User Info"
hKey = HKEY_USERS
RetVal = RegOpenKeyEx(hKey, szBuffer, 0, KEY_ALL_ACCESS, phkResult)
Value = "DefName"
RetVal = RegQueryValueEx(phkResult, Value, 0, 0, dataBuff, ldataBuffSize)
If RetVal = ERROR_SUCCESS Then
usernm = ConvertString(dataBuff, ldataBuffSize)
End If
'Close the keys
RegCloseKey hKey
RegCloseKey phkResult
End Sub
Username Call this function
IF u still have any problem make a reply
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only