Board index » cppbuilder » Rc-resource files not working!

Rc-resource files not working!

I've tried to make a resource file whith scripting
rc-files because its more powerful than the Borland Image
Editor and you are not limited to 256 colors.

the problem is: I cant get it to work!
it compiles fine, but when I try to load
a image from resource I get this error:

Project Project1.exe raised exception class EAccessViolation with message
'Access violation at adress 4130CD8E
in module 'VCL.BPL'. Read of adress FFFFFFFF'. Process stopped. Use Step or
Run to continue.

I use Borland C++ Builder 3.0 Standard

this is how I coded:

File://--------------------------------
Unit1.cpp ----------------------------
//--------------------------------------------------------------------------
-
#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include "xtraimages.rh"
//--------------------------------------------------------------------------
-
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//--------------------------------------------------------------------------
-
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{

Quote
}

//--------------------------------------------------------------------------
-

void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
Image1->Picture->Bitmap->LoadFromResourceID((int)HInstance,ID_TEST);

Quote
}

//--------------------------------------------------------------------------
-

File://-------------------------xtraimages.rc----------------------
#include "xtraimages.rh"

ID_TEST          BITMAP "close.bmp"

File://-----------------------xtraimages.rh------------------------
#ifndef XTRAIMAGES_RH
#define XTRAIMAGES_RH

#define ID_TEST             1000
#endif

I just cant figure out whats wrong. Please help, any help
highly apreciated.

 

Re:Rc-resource files not working!


Be sure that you have USERES instead of PRAGMA RESOURCE in your source since
sometimes it doesn't work.

--
Best regards
Igor Siticov
ICQ: 15354432
siComponents home page: http://www.votum.md/sicmps
Get the powerful RC scripts visual editor from Resource Builder 1.0 home
page: http://www.votum.md/sicmps/rb.htm

Joan D??? ???Y?? <8nkecu$k...@bornews.borland.com> ...

Quote
>I've tried to make a resource file whith scripting
>rc-files because its more powerful than the Borland Image
>Editor and you are not limited to 256 colors.

>the problem is: I cant get it to work!
>it compiles fine, but when I try to load
>a image from resource I get this error:

>Project Project1.exe raised exception class EAccessViolation with message
>'Access violation at adress 4130CD8E
>in module 'VCL.BPL'. Read of adress FFFFFFFF'. Process stopped. Use Step or
>Run to continue.

>I use Borland C++ Builder 3.0 Standard

>this is how I coded:

>File://--------------------------------
>Unit1.cpp ----------------------------
>//-------------------------------------------------------------------------
-
>-
>#include <vcl.h>
>#pragma hdrstop

>#include "Unit1.h"
>#include "xtraimages.rh"
>//-------------------------------------------------------------------------
-
>-
>#pragma package(smart_init)
>#pragma resource "*.dfm"
>TForm1 *Form1;
>//-------------------------------------------------------------------------
-
>-
>__fastcall TForm1::TForm1(TComponent* Owner)
>    : TForm(Owner)
>{
>}
>//-------------------------------------------------------------------------
-
>-

>void __fastcall TForm1::BitBtn1Click(TObject *Sender)
>{
>Image1->Picture->Bitmap->LoadFromResourceID((int)HInstance,ID_TEST);
>}
>//-------------------------------------------------------------------------
-
>-

>File://-------------------------xtraimages.rc----------------------
>#include "xtraimages.rh"

>ID_TEST          BITMAP "close.bmp"

>File://-----------------------xtraimages.rh------------------------
>#ifndef XTRAIMAGES_RH
>#define XTRAIMAGES_RH

>#define ID_TEST             1000
>#endif

>I just cant figure out whats wrong. Please help, any help
>highly apreciated.

Other Threads