From fbd6445c68745d484d5df8c75b0c12054185958f Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 16 Sep 2016 01:47:56 +0300 Subject: move source files to src/ --- process.hpp | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 process.hpp (limited to 'process.hpp') diff --git a/process.hpp b/process.hpp deleted file mode 100644 index 864d452..0000000 --- a/process.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include "error.hpp" - -#include -#include - -#include -#include - -namespace process -{ - std::wstring get_executable_path() - { - static constexpr DWORD max_path = MAX_PATH; - - std::array buf; - - const auto ret = GetModuleFileNameW(NULL, buf.data(), max_path); - - if (GetLastError() != ERROR_SUCCESS) - error::raise("GetModuleFileNameW"); - - return buf.data(); - } - - void runas(const std::wstring& exe_path, HWND hwnd = NULL, int nShow = SW_NORMAL) - { - SHELLEXECUTEINFOW info; - ZeroMemory(&info, sizeof(info)); - info.cbSize = sizeof(info); - info.lpVerb = L"runas"; - info.lpFile = exe_path.c_str(); - info.hwnd = hwnd; - info.nShow = nShow; - - if (!ShellExecuteExW(&info)) - error::raise("ShellExecuteExW"); - } -} -- cgit v1.2.3