23 lines
711 B
C++
Raw Normal View History

2024-01-08 23:37:00 +08:00
#include <windows.h>
2024-04-02 15:36:52 +08:00
#include <string>
#include <filesystem>
#pragma comment(linker, "/subsystem:windows /entry:mainCRTStartup")
int main()
{
2024-04-06 22:50:04 +08:00
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))
2024-04-02 15:36:52 +08:00
{
2024-04-20 21:31:29 +08:00
MessageBoxW(0, (L"Can't find LunaTranslator\\LunaTranslator_main.exe, please download again."), L"Error", 0);
2024-03-25 13:08:19 +08:00
return 0;
}
2024-01-08 23:37:00 +08:00
STARTUPINFO _1 = {};
PROCESS_INFORMATION _2;
2024-04-06 22:50:04 +08:00
CreateProcessW(exe.c_str(), NULL, NULL, NULL, FALSE, 0, NULL, currpath.c_str(), &_1, &_2);
2024-01-08 23:37:00 +08:00
return 0;
}