| 297 | |
| 298 | template<class T = std::filesystem::path> |
| 299 | T GetThisModuleName() |
| 300 | { |
| 301 | HMODULE hm = NULL; |
| 302 | GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCWSTR)&GetDesktopRefreshRate, &hm); |
| 303 | const T moduleFileName = GetModulePath<T>(hm); |
| 304 | |
| 305 | if constexpr (std::is_same_v<T, std::filesystem::path>) |
| 306 | return moduleFileName.filename(); |
| 307 | else if constexpr (std::is_same_v<T, std::string>) |
| 308 | return moduleFileName.substr(moduleFileName.find_last_of("/\\") + 1); |
| 309 | else |
| 310 | return moduleFileName.substr(moduleFileName.find_last_of(L"/\\") + 1); |
| 311 | } |
| 312 | |
| 313 | template<class T = std::filesystem::path> |
| 314 | T GetExeModulePath() |
nothing calls this directly
no outgoing calls
no test coverage detected