class Resource { public: // name and type can be specified by string id, // by integer id (RT_* constants or MAKEINTRESOURCE)
Resource(LPCWSTR name, LPCWSTR type,
HINSTANCE module = SysInfo::getCurrentModuleHandle());
Resource(UINT id, LPCWSTR type,
HINSTANCE module = SysInfo::getCurrentModuleHandle());
bool available() const;
// all this methods throw exception if the resource is not available unsigned size() const; // gets raw pointer to the resource data
LPCVOID rawData() const;
// save the resource to a file void saveToFile(const std::wstring &filePath) const;
typedef std::vector<BYTE> ByteArray; // returns the resource as byte array
ByteArray binary() const;
friendclass StringResource;
private:
std::wstring nameStr;
LPCWSTR namePtr; // can be integer value or point to nameStr.c_str()
std::wstring typeStr;
LPCWSTR typePtr; // can be integer value or point to nameStr.c_str()
HINSTANCE instance;
// Note: string resources are returned utf16 or utf8 encoded. // To get Windows-encoded string (utf16/ACP) use tstrings::toWinString(). class StringResource { public: // string resource is always identified by integer id
StringResource(UINT resourceId, HINSTANCE moduleHandle = SysInfo::getCurrentModuleHandle())
: impl(resourceId, RT_STRING, moduleHandle) {}
// returns the resource as string
tstring string() const; // nothrow version (logs error)
tstring string(const std::nothrow_t &, const tstring &defValue = tstring()) constthrow();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.