Using embedded resources

It is sometimes useful to embed resources in the executable itself instead of loading an external file (e.g. when your app is small and consists only of one exe file). XRC provides means to convert resources into regular C++ file that can be compiled and included in the executable.

Use the -c switch to wxrc utility to produce C++ file with embedded resources. This file will contain a function called InitXmlResource (unless you override this with a command line switch). Use it to load the resource:

  extern void InitXmlResource(); // defined in generated file
  ...
  wxXmlResource::Get()->InitAllHandlers();
  InitXmlResource();
  ...



ymasuda 平成17年11月19日