mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
added the helper functions
This commit is contained in:
@@ -77,4 +77,16 @@ std::wstring get_resource_string(UINT resource_id, HINSTANCE instance, const wch
|
||||
// Requires that
|
||||
// extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
// is added to the .cpp file.
|
||||
#define GET_RESOURCE_STRING(resource_id) get_resource_string(resource_id, reinterpret_cast<HINSTANCE>(&__ImageBase), L#resource_id)
|
||||
#define GET_RESOURCE_STRING(resource_id) get_resource_string(resource_id, reinterpret_cast<HINSTANCE>(&__ImageBase), L#resource_id)
|
||||
|
||||
// Function which takes a pointer ptr and allocates space before populating it with the string from the resource table
|
||||
// using this approach as wstring cannot be cast to PCWSTR without allocating space
|
||||
// hence, we have to malloc and free the pointer after each use
|
||||
wchar_t* get_resource_string_wchar(UINT resource_id, HINSTANCE instance);
|
||||
|
||||
// Wrapper for getting a string from the resource file.
|
||||
// Requires that
|
||||
// extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
// is added to the .cpp file.
|
||||
// used when the return type must be a wchar_t* instead of a wstring.
|
||||
#define GET_RES_STRING_WCHAR(resource_id) get_resource_string_wchar(resource_id, reinterpret_cast<HINSTANCE>(&__ImageBase))
|
||||
|
||||
Reference in New Issue
Block a user