Failed to concatenate specific string and text in image file path

I had a problem setting the image path in the resource file (.rc).

For some reasone, it was not possible to concatenate a specific line and text.

eg.

File1: #define Path "Brand_1" File2: #include File1 Logo BITMAP Path "\Logo.bmp" 

The Borland Resource Compiler (5.4) gives an error message: 39: Cannot open file: Brand_1

EDIT: My question is: Is it possible to combine the path for loading the image using the variable of the resource string and the string (file name).

In addition, the project I'm working on is associated with a file (Logo.bmp), present in two places. I would like to have a switch (.bat file) to generate another resouce file depending on the requirements.

Thanks.

+2
source share
2 answers

BRCC32 takes -i as a search path, separated by a semicolon, so you can create a bat file like this

compile_res.bat

 brcc32 -ic:\mypath1;c:\mypath2 resource_script 

and you define your script_resource as usual, for example:

resource_script.rc

 myImg BITMAP Logo.bmp myDOC RCDATA mydoc.doc 

when you run the compile_res.bat file, it will run the brcc32.exe file using the search path, and the bat file will save you from re-typing the search path every time.

+2
source

You are not concatenating anything. You are compiling Logo BITMAP "Brand_1" "\Logo.bmp" , and "Brand_1" not a valid path to the raster file.

#define in a resource compiler acts like find / replace in a word processor - not really, but close enough in this case.

You can get (untested) by removing quotes and spaces between them if there is no space in the space or file name; otherwise you are probably out of luck. (Not sure what you are trying to accomplish, anyway.)

+1
source

Source: https://habr.com/ru/post/1447656/


All Articles