edit1.Text:=inttostr(reg.readBinaryData('REGDBVersion',buf,sizeof(buf)));读取二进制时出错!!! 帮我看看

解决方案 »

  1.   

    buf: PByteArray;  
    count:integer//读取的长度
    s:string
            
    buf:=AllocMem(count);//分配缓存
    reg.ReadBinaryData('REGDBVersion',buf^,count); //读取二进制
    for i:=0 to  count-1 do s:=s+InttoHex(buf[i],2)+' ';//二进制转换成字符串
    FreeMem(buf,count); //释放缓存
      

  2.   

    sunkyling(尉迟冉冉) :不行啊?运行就出错了
      

  3.   

    buf: PByteArray;  
    count:integer//读取的长度
    s:string;
    info: TRegDataInfo; 
    reg:TRegistry;reg:=TRegistry.Create;
    reg.RootKey:=HKEY_LOCAL_MACHINE;
    if reg.OpenKey('Software\OLEforRetail\ServiceOPOS\CashDrawer\OmronCashDrawer',false)then        
    reg.GetDataInfo('REGDBVersion',info);
    count:=info.DataSize;
    buf:=AllocMem(count);//分配缓存
    reg.ReadBinaryData('REGDBVersion',buf^,count); //读取二进制
    for i:=0 to  count-1 do s:=s+InttoHex(buf[i],2)+' ';//二进制转换成字符串
    FreeMem(buf,count); //释放缓存