Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Reources and Images


This question is answered. Helpful answers available: 0. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Apr 3, 2017 12:49 PM Last Post By: Remy Lebeau (Te...
Gerald Holdsworth

Posts: 76
Registered: 5/23/12
Reources and Images  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 3, 2017 5:34 AM
Hi,

Having recently (well, in the last few months) moved from BDS2006 to Delphi 10.1 Berlin, I am slowly migrating my main projects over. One project, which is fairly new, got migrated early. However, another, much older, project has just been migrated - I actually thought it would be a right pain to migrate this one, seeing how big and complex it is - it was actually surprisingly very smooth, with just a few issues to iron out.

Anyway, in this project, under BDS2006, I had a number of external resources. I had a script (called 'Resources.rc') written with multiple lines thus:
DR1Decode RCDATA DR1Decode.dat
and
HandFlatCur CURSOR HANDFLAT.CUR
I then ran another script (called 'CompileResource.bat') which simply contained:
brcc32 Resources.rc
It was then a simple case of including the line
{$R Resources.res}
in the main form of the project.

I have now found, under Berlin, this new menu item (well, new to me) - Project->Resources and Images
The big question is - does this do the same job? Would I need to add more {$R xxx.res} lines, or will the one I've got do?
And, can I continue to use my original method instead?
(OK, that was three questions!!! And now someone will point out that BDS2006 had that menu item as well, and I just never noticed!!)

Cheers,

Gerald.
Peter Below

Posts: 1,227
Registered: 12/16/99
Re: Reources and Images
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 3, 2017 6:34 AM   in response to: Gerald Holdsworth in response to: Gerald Holdsworth
Gerald Holdsworth wrote:

Hi,

Having recently (well, in the last few months) moved from BDS2006 to
Delphi 10.1 Berlin, I am slowly migrating my main projects over. One
project, which is fairly new, got migrated early. However, another,
much older, project has just been migrated - I actually thought it
would be a right pain to migrate this one, seeing how big and complex
it is - it was actually surprisingly very smooth, with just a few
issues to iron out.

Anyway, in this project, under BDS2006, I had a number of external
resources. I had a script (called 'Resources.rc') written with
multiple lines thus: DR1Decode RCDATA DR1Decode.dat and
HandFlatCur CURSOR HANDFLAT.CUR
I then ran another script (called 'CompileResource.bat') which simply
contained: brcc32 Resources.rc
It was then a simple case of including the line
{$R Resources.res}
in the main form of the project.

This has been unnecessary for many versions. The $R command allows you
to specify both res and rc file for a resource, and if the compiler
cannot find the res it will call the resource compiler to create it
automatically.

Since RAD Studio Seattle, however, a $R statement in a unit may no
longer be enough, you have to add the resource (RC) file to the project
explicitely to get it linked in reliably.


--
Peter Below
TeamB

Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Reources and Images
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 3, 2017 12:49 PM   in response to: Gerald Holdsworth in response to: Gerald Holdsworth
Gerald wrote:

I then ran another script (called 'CompileResource.bat') which simply
contained:

brcc32 Resources.rc

It was then a simple case of including the line

{$R Resources.res}

in the main form of the project.

You did not need to run brcc32 manually, the IDE can do it for you, if you
include the .rc filename directly in your {$R} directive:

{$R Resources.res Resources.rc}


I have now found, under Berlin, this new menu item (well, new to me) -
Project->Resources and Images

The big question is - does this do the same job?

Yes. It is basically just a UI for an IDE-managed .rc file that gets compiled
into the final executable.

And, can I continue to use my original method instead?

Yes.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02