The res::lang functor finds a resource language identifier for a resource. When more language versions of the same resource are available, it returns the closest one to the chosen language.
When initializing the res::lang object, you may provide a handle to the module containing the resources. If no parameter is provided, the process executable is assumed.
The res::lang class provide following interface:
class res::lang {
public:
const void * const hInstance;
public:
lang (const void * = NULL);
template <typename TYPE_T, typename NAME_T>
unsigned short int operator ()
(TYPE_T, NAME_T, unsigned char = 0, unsigned char = 0) const;
};
To find a resource language identifier of a resource, invoke the .operator () () and provide the resource type, name and prefered language (type and subtype, which defaults to LANG_NEUTRAL and SUBLANG_DEFAULT). The operator returns the best language identifier found for the resource or throws the ext::object_not_exists exception if no such resource exists.
The lookup algorithm searches for resources in this order:
There are following exceptions to this order:
You will need to include "ext/res_bits/lang.cpp" into your project in order to use res::lang.
#include <windows.h>
#include <ext/res>
int main () {
std::printf ("%u\n", res::lang () (RT_STRING, 2, LANG_CZECH));
return 0;
};
Note that the win::lang is currently broken in way that use of RT_XXX constants will not compile if UNICODE is also defined.
[index]