mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-09 13:27:54 +08:00
212ea2de30
- remove common lib - split settings, remove common-md - move ipc interop/kb_layout to interop - rename core -> settings, settings -> old_settings - os-detect header-only; interop -> PowerToysInterop - split notifications, move single-use headers where they're used - winstore lib - rename com utils - rename Updating and Telemetry projects - rename core -> settings-ui and remove examples folder - rename settings-ui folder + consisent common/version include
24 lines
759 B
C++
24 lines
759 B
C++
#pragma once
|
|
#define WIN32_LEAN_AND_MEAN
|
|
#include <windows.h>
|
|
#include <string>
|
|
|
|
// Get a string from the resource file
|
|
inline std::wstring get_resource_string(UINT resource_id, HINSTANCE instance, const wchar_t* fallback)
|
|
{
|
|
wchar_t* text_ptr;
|
|
auto length = LoadStringW(instance, resource_id, reinterpret_cast<wchar_t*>(&text_ptr), 0);
|
|
if (length == 0)
|
|
{
|
|
return fallback;
|
|
}
|
|
else
|
|
{
|
|
return { text_ptr, static_cast<std::size_t>(length) };
|
|
}
|
|
}
|
|
|
|
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
|
// Wrapper for getting a string from the resource file. Returns the resource id text when fails.
|
|
#define GET_RESOURCE_STRING(resource_id) get_resource_string(resource_id, reinterpret_cast<HINSTANCE>(&__ImageBase), L#resource_id)
|