![]() |
|
كيف نضيف في ريجيستر value binary ؟ - نسخة قابلة للطباعة +- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum) +-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3) +--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15) +--- الموضوع : كيف نضيف في ريجيستر value binary ؟ (/showthread.php?tid=2639) |
كيف نضيف في ريجيستر value binary ؟ - ErRor0x22 - 11-12-2010 كيف نضيف في ريجيستر value binary ؟ اسم value OOBETimer value donné FF,D5,71,D6,8B,6A,8D,6F,D5,33,93,FD في مكان HKEY_LOCAL_MACHINE SOFTWARE\Microsoft\Windows NT\CurrentVersion\WPAEvents وشكراااا كيف نضيف في ريجيستر value binary ؟ - kachwahed - 11-12-2010 السلام عليكم كود : uses
Registry;
procedure SetRegistryData(RootKey: HKEY; Key, Value: string;
RegDataType: TRegDataType; Data: variant);
var
Reg: TRegistry;
s: string;
begin
Reg := TRegistry.Create(KEY_WRITE);
try
Reg.RootKey := RootKey;
if Reg.OpenKey(Key, True) then begin
try
if RegDataType = rdUnknown then
RegDataType := Reg.GetDataType(Value);
if RegDataType = rdString then
Reg.WriteString(Value, Data)
else if RegDataType = rdExpandString then
Reg.WriteExpandString(Value, Data)
else if RegDataType = rdInteger then
Reg.WriteInteger(Value, Data)
else if RegDataType = rdBinary then begin
s := Data;
Reg.WriteBinaryData(Value, PChar(s)^, Length(s));
end else
raise Exception.Create(SysErrorMessage(ERROR_CANTWRITE));
except
Reg.CloseKey;
raise;
end;
Reg.CloseKey;
end else
raise Exception.Create(SysErrorMessage(GetLastError));
finally
Reg.Free;
end;
end;
function BinToStr(const S: string): string;
var pInput : PChar;
pOutput: ^Byte;
N, LenInput: integer;
const
AtBin : array['0'..'1'] of byte = (0,1);
begin
LenInput := Length(S);
SetLength(result, LenInput shr 3);
LenInput := Length(result);
pInput := PChar(S);
pOutput := @result[1];
for N := 1 to LenInput do
begin
pOutput^ := 0;
pOutput^ := byte( (AtBin[pInput[0]] shl 7) or
(AtBin[pInput[1]] shl 6) or
(AtBin[pInput[2]] shl 5) or
(AtBin[pInput[3]] shl 4) or
(AtBin[pInput[4]] shl 3) or
(AtBin[pInput[5]] shl 2) or
(AtBin[pInput[6]] shl 1) or
AtBin[pInput[7]]
);
inc(pInput, 8);
inc(pOutput);
end;
end;كيف نضيف في ريجيستر value binary ؟ - ErRor0x22 - 12-12-2010 لم ينجح if RegDataType =rdUnknown then هنا خطأ اين اضع اسم value و value de donné وشكرا |