OverviewExamples
value_names = Registry.GetValueNames(HKEY_LOCAL_MACHINE, "Software\\My Application");
Gets all the value names within the sub key "HKEY_LOCAL_MACHINE\Software\My Application" and stores them in a table called "value_names."
strRegValues = "";
bFound = false;
tbRegValues = Registry.GetValueNames(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer");
-- Check for error code.
error = Application.GetLastError();
if (tbRegValues) then
for index,value in pairs(tbRegValues) do
-- Create a string of the registry value names with each name on a new line.
strRegValues = strRegValues..value.."\r\n";
if (String.CompareNoCase(value,"Logon User Name") == 0) then
bFound = true;
end
end
else
Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
end
-- Set the string for the found key.
if (bFound) then
strRegValues = strRegValues.."\r\n".."The key 'Logon User Name' was found.";
else
strRegValues = strRegValues.."\r\n".."The key 'Logon User Name' was not found.";
end
-- Show a dialog with the values and whether the key was found.
Dialog.Message("RegValues", strRegValues, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Gets all the value names within the sub key "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer" and stores them in a table called "tbRegValues." It then stores each name in a string and determines whether or not the key "Logon User Name" was found. The results are shown in a dialog message.
See also: Related Actions