Resources and Images"..." /> Resources and Images"..." /> Resources and Images"..."/>

Loading a VCLSTYLE from a resource in a BPL

276 views Asked by At

Using Embarcadero C++Builder XE7.

We have placed a few styles into a resource. The styles have been added using the "Project -> Resources and Images" dialog. The resulting .rc file looks like this:

Auric VCLSTYLE "C:\\Program Files (x86)\\Embarcadero\\Studio\\15.0\\Redist\\styles\\vcl\\Auric.vsf"
Carbon VCLSTYLE "C:\\Program Files (x86)\\Embarcadero\\Studio\\15.0\\Redist\\styles\\vcl\\Carbon.vsf"

During build, I can see the resource is built and linked.

I would like to now access this from my main application, which has linked to this lib, using TStyleManager::Styles. No matter if I include the RC directly, or put it in a BPL and load it with LoadPackage(), However, it only returns the Windows style, not the ones listed above. How do I get the main application to load these resources?

1

There are 1 answers

2
Bizmarck On BEST ANSWER

When adding the aforementioned RC file by hand to the library (or application directly), so that it could be compiled by the resource compiler into a RES file and linked into BPL (or into the application executable), I needed to add

#include <Vcl.Themes.hpp>
#include <Vcl.Styles.hpp>

in the application. Otherwise, even though the RC is linked correctly, the styles are not accessible at runtime.