//打开文件
AssignFile(f,'C:/SH000002.dat');
Reset(f);
FileHandle := FileOpen('C:/SH000002.dat', fmOpenReadWrite or fmShareDenyNone);
MapHandle := CreateFileMapping(FileHandle,nil,Page_ReadWrite,0,FileSize(f),'test');
Buf := MapViewOfFile(MapHandle,File_Map_All_Access,0,0,0);
//填充文件类型
filehead.m_dwAttrib := News_Sha_Ex;
filehead.m_dwLen := FileSize(f);
filehead.m_szFileName := 'C://SH000002.dat';
glparm.m_wDataType := FILE_NEWS_EX;
glparm.m_nPacketNum := 1;
glparm.m_File := filehead;
glparm.m_bDISK := False;
glparm.m_pData := Buf;
//发送消息
SendMessage(RecForm,Msg_StkData,RCV_FILEDATA,Longint(@glparm));
UnMapViewOfFile(Buf);
CloseHandle(MapHandle);
CloseFile(f);
我用了文件映射,谁有更简单的方法?