Hi All,
if you living problems with working wince or pda registry for example like me, you read this.
function GetRegValue(key, data:PWidechar; hkeyroot:hkey=HKEY_LOCAL_MACHINE):String;
var
RegKey: HKEY;
regvalue: array[0..255] of WideChar;
BufLen: DWORD;
res:integer;
begin
try
if RegOpenKeyEx( HKEY_LOCAL_MACHINE ,key,0, KEY_QUERY_VALUE, RegKey )=ERROR_SUCCESS then
begin
res:=RegQueryValueEx(RegKey, data, nil, nil, @RegValue, @BufLen);
if (res=ERROR_SUCCESS) then
result:=regvalue else begin
showmessage('Couldnt read registry value! errorcode:'+inttostr(res));
end;
RegCloseKey(RegKey);
end else showmessage('Couldnt open regkey!');
except
showmessage('Couldnt access registry!');
result:='';
end;
end;
Problem :
Error code 234 and mean is "buffer is too small to receive the data" ERROR_MORE_DATA
Solution:
simple. Increase the buffer area only need to do.
For Example:
regvalue: array[0..255] of WideChar; --> regvalue: array[0..512] of WideChar;