TMemoryStream *mem = new TMemoryStream();
mem->LoadFromFile("c:\\image.bmp");

BYTE *data = (BYTE *) malloc(mem->Size);

memcpy(data,mem->Memory,mem->Size);
int size = mem->Size;

mem->Clear();
mem->Write(data,size);



Graphics::TBitmap *bmp = new Graphics::TBitmap;
bmp->LoadFromStream(mem);


for(int i = 0; i < 48 ; i++)
{
for(int k = 0; k < 192; k++)
{
Image1->Canvas->Pixels[k][i+50] = bmp->Canvas->Pixels[k][i];
}
}


i am writing a dll for a project.
one of the function need to get bitmap file in an array as parameter
and do some operations on it,

so i tried to do this on a form application first
i am using TMemoryStream to load bitmap;


so i need TMemoryStream to be loaded from BYTE array.

i decided to load a TMemoryStream from a file,
write it to BYTE array
and write back it to Stream.

when i load the bitmap it is just black.
if i don't include array part (save and load back)
everything is ok.

so i wonder same data is in Stream,
why bitmap is all black?

anybody have an idea?