Retrieves a binary value from a specified data value associated with the current key. function ReadBinaryData(const Name: String; var Buffer; BufSize: Integer): Integer;DescriptionCall ReadBinaryData to read a binary value from a specified data value associated with the current key. Name is the name of the data value to read. Buffer is the application variable into which to read the registry data. Buffer must be large enough to hold all of the data returned. BufSize specifies the size of Buffer.If successful, ReadBinaryData returns the requested data. If the Registry entry contains a known type (such as a string), an exception is raised.Note: Binary data is typically a record. It might also be an icon or a bitmap although Microsoft recommends against storing graphics objects in the registry for performance reasons.

解决方案 »

  1.   

    读取:(在uses里加入register)
    var
      reg:tregister;
      buf:string;
    begin
      reg.create;
      ... //一般的设置(rootkey等)
     reg.readbinarydata('mykey',buf,256);
      showmessage(buf);
    end;
      

  2.   

    function BinToInt(InStr:String):Integer;
    var
      LoopCounter:Integer;
    begin
    Result := 0;
    for LoopCounter := 1 to Length(Instr) do
      Result := Result + Trunc( StrToInt(InStr[LoopCounter]) *
                 Power(2, Length(InStr)-LoopCounter ) );
    end;
      

  3.   

    读取:(在uses里加入register)
    var
      reg:tregister;
      buf:string;
    begin
      reg.create;
      ... //一般的设置(rootkey等)
     reg.readbinarydata('mykey',buf,256);
      showmessage(buf);
    end; reg.readbinarydata('mykey',buf,256);
    出错了,说明无效的数据类型,
      

  4.   

    buffer的类型错了,不应该是string;