怎么把两个DWORD合成一个大整数,表示出来? (100分)

  • 主题发起人 主题发起人 caidao
  • 开始时间 开始时间
C

caidao

Unregistered / Unconfirmed
GUEST, unregistred user!
使用GetFileSize,碰到的问题。
 
procedure TForm1.Button2Click(Sender: TObject);<br>var I,J:DWORD;<br>&nbsp; &nbsp; K:Int64;<br>begin<br>&nbsp; I:=1;J:=2;<br>&nbsp; Int64Rec(K).Hi:=I;<br>&nbsp; Int64Rec(K).Lo:=J;<br>&nbsp; ShowMessage(IntToStr(K));<br>end;<br>
 
用Int64类型.<br>var<br>&nbsp;d1, d2: DWoed; <br>&nbsp;i6: Int64;<br>begin<br>&nbsp; i6 := d1 shl 32 + d2;
 
Int64Rec separates parts of an 8-byte value.<br><br>Unit<br><br>SysUtils<br><br>type<br><br>&nbsp; Int64Rec = packedrecord<br>&nbsp; &nbsp; case Integer of<br>&nbsp; &nbsp; &nbsp; 0: (Lo, Hi: Cardinal);<br>&nbsp; &nbsp; &nbsp; 1: (Cardinals: array [0..1] of Cardinal);<br>&nbsp; &nbsp; &nbsp; 2: (Words: array [0..3] of Word);<br>&nbsp; &nbsp; &nbsp; 3: (Bytes: array [0..7] of Byte);<br><br>&nbsp; end;<br><br>Description<br><br>Int64Rec declares a record that stores the various parts of the specified value as type Cardinal, Word or Byte.
 
谢谢三位。<br>&nbsp; DWORD dwLowSize = 0, dwHighSize = 0;<br>&nbsp; long double dSize = 0;<br>&nbsp; dwLowSize = GetFileSize(f, &amp;dwHighSize);<br><br>&nbsp; if (dwLowSize != 0xFFFFFFFF)<br>&nbsp; {<br>&nbsp; &nbsp; dSize = dwHighSize * 1024 * 1024 * 1024;<br>&nbsp; &nbsp; dSize *= 4;<br>&nbsp; &nbsp; dSize += dwLowSize;<br>&nbsp; &nbsp; TCHAR buf[256] = { 0 };<br>&nbsp; &nbsp; sprintf(buf, "%-20.0Lf", dSize);<br>&nbsp; &nbsp; ShowMessage("filesize = " + String(buf) );<br>&nbsp; }
 
后退
顶部