Delphi 5 res file problem

Hi there,

I am using Delphi 5, and including icons through a resource file, which I check out from VCS, and after running the delphi action the .res file is wiped and I get no icon in my application!

I have set the action to Delphi 5, and also set the flag for compiler bug work around (…which I really don’t know what bug it is working around, but it sounded like a good thing to select…). Running FinalBuilder 4.0.0.77

I load the project settings from the provided button in the action, and the icon never shows up.

I am still investigating if the .res gets wiped when I load project settings or when I actually run the action.

Hope you can help!

Thanks,
~ Rob

Hi Rob,

First you should update to the latest version of FB, here’s the download:
https://www.finalbuilder.com/downloads/finalbuilder/420/FB420_276.exe

If FB isn’t extracting the icon, then you can manually set it by simply setting the filename of the .ico file you want to use.

hth.
.t8

I will try the new version when I have a chance. For most of my projects, I do not use an explicit .ico file, and instead use the one imported from the .res files.

Also, in some cases the .res contains other information which is needed and I can’t have FinalBuilder wiping out my source files in any case.

Thanks,
Rob

Hi Rob,

FinalBuilder doesn’t modify your .res files.

.t8

Hi Rob

The .res file is regenerated by finalbuilder if you have the Regenerate Resource option checked (on by default). This is needed to update the version info. Delphi does the same thing in the ide. Since this res file contains both the icon and the version info, when you select the delphi project for the action finalbuilder will attempt to extract the icon from the .res file (it has no other way of knowing which icon file was used). This is saved as mainicon.ico in the same folder as the delphi project, and the icon file property is set to the path to that file. If this fails (does sometimes happen with some icons), you can just set the icon property to the path to your original icon file.

As for other information in the .res file, I’m not aware of any way to achieve this, and if you are doing this manually then the delphi ide would overwrite this information anyway.

I hope this clarifies things a bit better.




Hi Vincent,

I’ll bet that is my problem! In most of my cases I am losing the icon, and the action originally fails because it cannot find mainicon.ico and I had been clearing the icon file field just to get through the build. So if I just turn off this option, then I will use the original .res file then?

Also, on a side note regarding the BCB action; under the project tab, there are many “Use *** Options” check boxes. By checking a box does it use the options from the action, or the original options from the project? I would like to match the makefile that would be created from the IDE “export makefile” before changing/adding options through FinalBuilder.

Thanks for all your help so far!

~ Rob

Hi Rob

If you turn off Regenerate Resource, then FinalBuilder will not overwrite your .res file, and won’t use the icon field. However, this also means it won’t generate version info either.

For the BCB action, the way it works is that it first loads the project file settings from the bpr/bpk file, and then depending on which Use *** options are set, applies finalbuilders settings to the file and then writes it out as FBTemp.bpr and then call bpr2mak. So if all the Use *** settings are turned off it will just use whatever is in the original project file. Note that this does not guarantee that it will be exactly the same as the make file exported from the IDE, because bpr2mak has some bugs which occur occasionally. We are talking to Borand/Devco about this at the moment, hoping to get a better solution in future versions of BCB.


We’re seeing this in D7 today, and it’s annoying. Mostly because it’s not something that can be fixed - at random invervals our builds start failing because mainicon.ico is not in the project directory, so I have to clear that part of the FB settings in each Delphi build, and we have about 10 of them. The problem might be related to us building in the Delphi IDE, but of course that works fine and regenerates the res file if it needs to. It definitely happens more often if I try to include version info in command line exes (which apparently don’t support it).

What happens to the mainicon.ico file? If Regenerate resource is checked then the .res file is recreated, if you blank out the path to the icon file then you will end up with no icon. The simplest solution is to set the path to the icon to the icon file you want used for the application.

There never is a manicon.ico file, because there never is an icon. It’s just that somehow FinalBuilder decides that there should be one, and adds the reference, but doesn’t make sure that it points to an actual file.

Interesting. Some projects have the mainicon.ico file in them even though Delphi’s project options won’t allow me to select an icon (dll projects), but FinalBuilder doesn’t enforce that restriction (it lets me choose an icon, and version info for console apps etc). It appears that if you tell the command line compiler to use an icon the icon has to exist, even if it won’t be used.

I have a similar problem on 5.0.0.60. I need the icon information from the res file, but also need to set new version infomation and rewrite res file with current icon info and new version information before the build. Is this possible? Its a large build process with lots of apps and I would not like to have to redo all the original icons!

At the moment it loses my icon information and sets versioning fine when I regenerate the res file.

The simplest work around to this problem (I will look at this next week to see if we can improve how it works) is to set the icon file property in finalbuilder to the icon file you want to be used. If it’s a dll project, just blank out the field.

Is there any way to automate extracting the icon file from the res file before the res gets regenerated? Even if you could recommend an external commandline app it would be great. The icons are all saved in res files under Icon"MAINICON", but we have ±168 projects per minor version so doing it manually is not really an option.

Regards
Carl

Hi Carl

I have uploaded a simple console application to the community downloads page, which will extract the main icon from the res file specified on the command line. This application uses the same code as we use in the property page for the delphi action.

HTH