Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add MSWord file in delphi 7 project directory

I want to add MS Word file in my delphi 7 project directory.I already have created resource file (.rc) and include Word file in it.But when I am compiling .rc with BRCC32, it shows [Error] RLINK32: Unsupported 16bit resource in file "C:\Program Files (x86)\Borland\Delphi7\Projects\stuff.rc". What I have to do?

like image 398
Farhan Ali Avatar asked Dec 24 '12 08:12

Farhan Ali


1 Answers

The error message indicates that you are attempting to link the resource script, the .rc file, rather than the compiled resource, the .res file.

So you presumably have a line that reads:

{$R stuff.rc}

This instead should read

{$R stuff.res}

What's more, judging from the error message, I suspect that you resource script, the .rc file, is not a resource script. I bet that it is in fact a Word document.

Your .rc file needs to be a text file that looks like this:

WordDocument RCDATA MyDoc.doc

You also need to compile your script. Like this:

brcc32 stuff.rc

This compilation step produces the binary compiled resource file, the .res file.


To make it crystal clear, you need to carry out these steps:

  1. Make the .rc file as described above.
  2. Compile the .rc file with brcc32.
  3. Link the compiled resource by adding {$R stuff.res} to one of your Delphi source files.

You need to go back to basics and try to understand Windows resources better.

  • About Resource Files (Windows)
  • Resource Files Made Easy (delphi.about.com)
  • how to add resources and to use them
like image 89
David Heffernan Avatar answered Sep 20 '22 19:09

David Heffernan