As far as I know, you can't use Delphi-constants like "RT_FONT" inside
resource-scripts; you'll have to use the literal text like:

==================================================================
ABC1 FONT "C:\PathToFontfile\FontName.ttf"
==================================================================

You can examine how a resource is compiled into your application with
a resource-viewer/editor like the one that came with Delphi called
"Resource Workshop" which can be found on the Delphi-CD and has to be
installed separately or similar.

My personal favorite is PE Explorer, but it's not free...
http://www.heaventools.com

BTW. You can automatically let Delphi compile the resource-script
by using this line into your project-file (*.dpr):

==================================================================
program MyProject;

{$R 'MyResource.res' 'MyResource.rc'}

uses
  Forms,
...
==================================================================

Don't forget to "Build" your project after changing a resource;
when you use "Compile" they won't be re-compiled.


Greetz,

Peter.

-----Oorspronkelijk bericht-----
Van: [email protected] [mailto:[email protected]]namens
Bobby Clarke
Verzonden: zaterdag 27 juni 2009 16:25
Aan: [email protected]
Onderwerp: [delphi-en] Failure to use font as a resource





I am trying to use fonts in my program without installing them on the
user's (target) computer as this requires a re-boot before the fonts are
available. I have done many of the steps but something is missing. Any
help would be appreciated. Thanks in advance for any help offered.

Bobby Clarke

Here are the steps I have taken:

Created file resource.rc containing two lines of text:

ABC1 RT_FONT C:\...\ABC01.ttf
ABC2 RT_FONT C:\...\ABC02.ttf

Used brcc32.exe in a batch file to compile to resource.res

In the Delphi program, I have

implementation

{$R *.dfm}
{$R resource.res}

procedure TFMain.FormCreate(Sender: TObject);
var
hFind : THandle;

begin

hFind := FindResource(Handle,'ABC1',RT_FONT); // returns zero
if hFind = 0 then
ShowMessage(' FindResource failed. Error: '+IntToStr(GetLastError))

Reply via email to