Board index » delphi » sharing memory mapped bitmaps
kim
![]() Delphi Developer |
sharing memory mapped bitmaps2003-09-05 08:15:09 AM delphi10 hello, Does anyone know of an example of sharing DIBs using memory mapped files? I want to send a series of bitmaps from my Delphi application to my Delphi DLL. This code from another message thread somewhere seems to work in setting up the MMF in my application although I have no idea how to reference it afterwards in my DLL. ----------------- var BitmapInfoSize: Integer; hMap: THandle; pMap: Pointer; MemStream: TMemoryStream; begin Image1.Picture.Bitmap.SaveToStream(MemStream); BitmapInfoSize := PBitmapFileHeader(memstream.Memory)^.bfOffBits-SizeOf(TBitmapFileHeader); try hMap := CreateFileMapping($FFFFFFFF, nil, PAGE_READWRITE,0,BitmapInfoSize,'MMBMP'); pMap := MapViewOfFile(hMap,FILE_MAP_ALL_ACCESS,0,0,0); memstream.Seek(SizeOf(TBitmapFileHeader),0); memstream.Read(pMap^,BitmapInfoSize); finally // unmapViewOfFile(pMap); //Disposes the mem map CloseHandle(hMap); end; end; ---------------- Any advice is appreciated Kim ps. I posted this message though Google but it didn't show up, so apologies if it turns up again.... |