Loading BMP from Resource

I am trying to load BitMap from resource with next Delphi2 code:


      {$R Resource}

          Bitmap := TBitmap.Create;
          Bitmap.LoadFromResourceName(HInstance, 'Bitmap1');


But I am getting message:

      "Resource BITMAP1 not found."

What have I done wrong?
bor061297Asked:
Who is Participating?
 
shogiConnect With a Mentor Commented:

This is ok
      Bitmap := TBitmap.Create;
      Bitmap.LoadFromResourceName(HInstance, 'Bitmap1');

Two possibility :
1) {$R Resource}   it's not the good one
2) your resource.res file don't have the Bitmap1 in .

Regards
Shogi
0
 
petervlCommented:
Also Verify that your resource file doesn't have the same name as your application as Delphi will overwrite that to add the main Icon, version information etc.
0
 
bor061297Author Commented:
Neither of it...
0
 
bor061297Author Commented:
Neither of it...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.