Search code examples
c++c++builderc++builder-6

Load images from file (any pc works) C++ Builder


I want to load some images from a folder but I want to works on another pc.

I load an image like this:

Image1->Picture->Bitmap->LoadFromFile("C:\\Users\\Raul\\Desktop\\Cards BMP\\2_of_diamonds.bmp" );

And when I run project on another pc that "C:\Users\Raul\Desktop\" is diffrent.

How can I load that image from another pc?

I use C++ Builder 6.


Solution

  • You can create a folder called Images where your project is, where are the files are created etc. Then you just have to do

    Image1->Picture->Bitmap->LoadFromFile("Images/2_of_diamonds.bmp" );
    

    And it can be done from any pc because the image is in the project folder.