I am currently writing a simple screensaver in D4. I want to draw a series of Tbitmap 
objects directly onto the canvas of my main form (ie not use TImage objects). I want 
to include the bitmap files in a resource file so that the screensaver can be 
distributed as a single .scr file.

I am currently unable to successfully load a bitmap from a resource file. This is my 
first attempt at using resource files, and I suspect that I am missing something 
fairly fundamental.

Here's what I've done so far:

Created an array of TBitmap objects. I want to assign a bitmap from a resource file to 
each item in the array using the TBitmap.LoadFromResourceName method. 

Created a resource file using D4's Image Editor tool. I added a bitmap called 'TEST' 
and saved the resource file into the project's directory under the name of 
'PICTURES.RES'.

Included the resource file in my unit with the following compiler directive:
{$R PICTURES.RES}

I then try the following:
BitMap1 := TBitMap.Create;
BitMap1.LoadFromResourceName(Application.Handle,'TEST');

When this code is called, an EResource exception is raised stating that the object 
'TEST' could not be found in the resource file. 

Am I missing something here?? Do I need to specify the name of the resource file that 
'TEST' resides in somehow??

Many thanks,
James.





---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to