LoadFromResourceName (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example requires a resource file in the sources directory.


Code

#pragma resource "extrares.res"
#include <memory>       //For STL auto_ptr class

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  std::auto_ptr<Graphics::TBitmap> Bitmap1(new Graphics::TBitmap());
  try
  {
	Bitmap1->LoadFromResourceName((int)HInstance, "Live");
    Canvas->Draw(12,12,Bitmap1.get());
  }
  catch (...)
  {
    MessageBeep(0);
  }
}

Uses