c++builder firemonkey Load a image url get ‘Loading bitmap failed’ error


I found this example and tried to load an image from my localhost:

void __fastcall TForm1::Button1Click(TObject *Sender)
TMemoryStream *strm = new TMemoryStream;
IdHTTP1->Get(L””, strm);
strm->Position = 0;

But I´m getting this error:

Project Project1.exe raised exception class EBitmapLoadingFailed with message ‘Loading bitmap failed.’

The image (ima.png) is in the correct place, and it opens perfectly when I load it manually in a TImage in the MultiResBitmap options. And it opens perfectly when using Image1->Bitmap->LoadFromFile(“c:\\server\\ima.png”);

I tried to get other images from the Internet, but get the same error.
In fact, I need to load PNG and JPG files from my webserver (online) at runtime using Firemonkey on Android and iOS.

I’m using C++Builder 10.2.1 Tokyo, and would like a C++Builder example.
No Delphi please!

Comments are closed.