procedure TForm1.Button2Click(Sender: TObject);
var
hFile, hMap : THandle;
pData : Pointer;
lpReOpenBuff: TOFStruct;
Buff : array[0..255] of Char;
Const
OFFSET_NUM = 10
//从位置i-1
begin
hFile := OpenFile('c:/1.txt', lpReOpenBuff, OF_READ);
if hFile <> HFILE_ERROR then
begin
hMap := CreateFileMapping(hFile, nil, PAGE_READONLY, 0, 0, nil);
if hMap <> 0 then
begin
pData := MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0);
CopyMemory(@Buff, Pointer(LongInt(pData) + OFFSET_NUM), 255);
ShowMessage(Buff);
UnmapViewOfFile(pData);
CloseHandle(hMap);
end;
CloseHandle(hFile);
end;
end;