aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/resource.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resource.hpp')
-rw-r--r--src/resource.hpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/resource.hpp b/src/resource.hpp
index 0e3186c..a0f1cc3 100644
--- a/src/resource.hpp
+++ b/src/resource.hpp
@@ -5,13 +5,30 @@
#pragma once
+#include "error.hpp"
+#include "process.hpp"
+
#include <Windows.h>
+#include <cstddef>
+
#include <string>
namespace resource
{
- HMODULE load_exe_module();
+ inline std::wstring load_string(unsigned int id)
+ {
+ wchar_t* s = nullptr;
+
+ const auto ret = LoadStringW(
+ process::load_exe_module(),
+ id,
+ reinterpret_cast<wchar_t*>(&s),
+ 0);
+
+ if (ret <= 0)
+ error::raise("LoadStringW");
- std::wstring load_string(unsigned int id);
+ return {s, static_cast<std::size_t>(ret)};
+ }
}