var<br> f: file of Byte;<br> size : Longint;<br> S: string;<br> y: Integer;<br> begin<br> if OpenDialog1.Execute then<br> begin<br> AssignFile(f, OpenDialog1.FileName);<br> Reset(f);<br> size := FileSize(f);<br> S := 'File size in bytes: ' + IntToStr(size);<br> y := 10;<br> Canvas.TextOut(5, y, S);<br> y := y + Canvas.TextHeight(S) + 5;<br> S := 'Seeking halfway into file...';<br> Canvas.TextOut(5, y, S);<br> y := y + Canvas.TextHeight(S) + 5;<br> Seek(f,size div 2);<br> S := 'Position is now ' + IntToStr(FilePos(f));<br> Canvas.TextOut(5, y, S);<br> CloseFile(f);<br> end;<br> end;<br>你把对话匡替换为你正在打开的文件,就好了。<br>函数你应该知道吧。exetractfilepath等等。