I got into strange behavior in Delphi.
I need to apply correct logo.jpg in a runtime. So I created the list in logo.rc file and produced logo.RES file out of it.
Image1 RCDATA "Img\logo1.jpg"
Image2 RCDATA "Img\logo2.jpg"
Now, I want to display the correct image. In MyForm I pass the correct resource name:
MyStream := TResourseStream.Create(HInstance, 'Image1', RT_RCDATA);
try
MyImage.Picture.LoadFromStream(MyStream);
finally
MyStream.Free;
Now I want to add directive to use this newly created resource. I do that in .dpr file, just under the regular directive:
{$R *.RES}
{$R Logo.RES}
But when I run the project, I got an image that once was in use. Looks like Delphi somehow "remembers" it from somewhere and I cannot figure out where from. I don't see any references to that old file in project's options.
I tried to delete project.RES/project.dres files and recompile to let it create the file again.
I tried to delete the first directive. Then in run time I do get the proper image, but the Access violation in KernekBase.dll is thrown.
I tried even to change the name of my newly Logo.RES to the projectName.RES.
And I'm still getting the old image. I'm using Delphi 10.2.
Maybe someone has some insights on how to tackle this problem? Thank you