恍兮惚兮 5dcec35687 fix
2024-04-06 22:50:04 +08:00

23 lines
643 B
C++

#include <windows.h>
#include <string>
#include <filesystem>
#pragma comment(linker, "/subsystem:windows /entry:mainCRTStartup")
int main()
{
TCHAR szPath[MAX_PATH];
GetModuleFileName(NULL, szPath, ARRAYSIZE(szPath));
std::wstring moduleName = szPath;
auto currpath = moduleName.substr(0, moduleName.rfind(L'\\'));
auto exe = currpath + L".\\LunaTranslator\\LunaTranslator_main.exe";
if (!std::filesystem::exists(exe))
{
MessageBoxW(0, exe.c_str(), L"Error", 0);
return 0;
}
STARTUPINFO _1 = {};
PROCESS_INFORMATION _2;
CreateProcessW(exe.c_str(), NULL, NULL, NULL, FALSE, 0, NULL, currpath.c_str(), &_1, &_2);
return 0;
}