PDAclub.pl - Forum użytkowników technologii mobilnych
Windows Mobile (Classic, Professional, Standard), Windows Phone 6.x oraz 7/8.x/10 => Oprogramowanie PPC => Dla programistów => Wątek zaczęty przez: mediacon w Wrzesień 13, 2006, 16:46:42
-
Czy ktoś wie dlaczego ta funkcja nie wstawia wpisu typu DWORD do rejestru?
/// <summary>
/// Create a DWORD value in the specified registry key
/// </summary>
/// <param name="Key">Name of hKey to access</param>
/// <param name="keyName">Name of key</param>
/// <param name="valueName">Name of value</param>
/// <param name="dwordData">Value data</param>
/// <returns>ERROR_SUCCESS if successful</returns>
public int CreateValueDWORD(UIntPtr Key, string keyName, string valueName, uint dwordData)
{
UIntPtr hkey = UIntPtr.Zero;
try
{
int result = RegOpenKeyEx(Key, keyName, 0, KeyAccess.None, ref hkey);
// if (ERROR_SUCCESS != result)
// return result;
byte[] bytes = BitConverter.GetBytes(dwordData);
return RegSetValueEx(hkey, valueName, 0, KeyType.Dword,
bytes, (uint)bytes.Length);
}
finally
{
if (UIntPtr.Zero != hkey)
{
RegCloseKey(hkey);
}
}
WriteRegistryKey(Key, keyName, valueName, dwordData);
return ERROR_SUCCESS;
}
-
Ty mając dane wejściowe, kod i debugger powinieneś to wiedzieć. ;)
Zobacz jaki błąd ona zwraca i w ogóle w którym miejscu się sypie, wtedy spróbujemy coś zaradzić.