我这正好有个例子:<br> RPtValue =record<br>// x,y:double;<br> Pt_id:integer;<br> pt_value:single;<br> pt_state:integer;<br>// pt_unit:string[10];<br> end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> hMap:THandle;<br> data,d:^RPtValue;<br> i:integer;<br>begin<br> hMap:=CreateFileMapping(-1,nil,PAGE_READONLY,0,1024,'SHARE_MEMORY');<br> if hMap=NULL then exit;<br> data:=Mapviewoffile(hMap,FILE_MAP_READ,0,0,0);<br> d:=data;<br> for i:=0 to 25 do<br> begin<br> memo1.Lines.Add(inttostr(d^.Pt_id)+':'+floattostr(d^.pt_value)+':'+inttostr(d^.pt_state));<br> inc(d);<br> end;<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>var<br> hFile:THandle;<br> hMapping:THandle;<br> data,d:^integer;<br> i:integer;<br>begin<br> hMapping:=CreateFileMapping(-1,nil,PAGE_READWRITE ,0,1024,pchar('SHARE_MEMORY'));<br> data:=MapViewOfFile(hMapping,FILE_MAP_WRITE,0,0,0);<br><br> d:=data;<br> for i:=0 to 25 do<br> begin<br> d^:=ord('a')+i;<br> inc(d);<br> end;<br><br>end;<br>