I don't have the VB code, but here is some C# code that I use all of the
time.
public class OwnerName {
[DllImport("coredll.dll", EntryPoint = "RegOpenKeyEx", SetLastError =
true)] private static extern int RegOpenKeyEx(uint hKey, string lpSubKey,
int ulOptions, int samDesired, ref uint phkResult);
[DllImport("coredll.dll", EntryPoint = "RegQueryValueEx", SetLastError =
true)] private static extern int RegQueryValueEx(uint hKey, string
lpValueName, int lpReserved, ref uint lpType, byte[] lpData, ref int
lpcbData);
[DllImport("coredll.dll", EntryPoint = "RegCloseKey", SetLastError =
true)] private static extern int RegCloseKey(uint hKey);
private const int ERROR_SUCCESS = 0x0;
private const uint HKEY_CURRENT_USER = 0x80000001;
public static string GetOwnerName() {
int lngSize = 256;
uint hlngSubKey = 0;
uint lngType = 0;
long lngResult;
byte[] regData = new byte[256];
//Handle (hlngSubKey) to the "\ControlPanel\Owner" key
lngResult = RegOpenKeyEx(HKEY_CURRENT_USER, @"\ControlPanel\Owner",
0, 0, ref hlngSubKey);
//Read the "Owner" info frm open registry key
lngResult = RegQueryValueEx(hlngSubKey, "Owner", 0, ref lngType,
regData, ref lngSize);
//Release the key handle
lngResult = RegCloseKey(hlngSubKey);
//Return the data
string ownerName = System.Text.Encoding.Unicode.GetString(regData,
0, 72).TrimEnd('\x0');
return ownerName;
}
}
rt said:
i could not find any help of that info.
thanks