bool CALLBACK runBtnClick(HELE hEle, HELE hEventEle) {
edit_text();
wchar_t wbuf [2 * MAX_PATH] = {0}; char cmdline[2 * MAX_PATH] = {0}; swprintf(wbuf, L"\"%s\" \"%s\" %s\\" , appFile, docFile, fontPath); WCHARTochar(cmdline, wbuf);
MessageBoxA(NULL, cmdline, "注意: 确认目录存在,不能有空格", MB_OKCANCEL); execute_command(cmdline);
return true; }
int execute_command(char* cmdline) { SetConsoleTitle(cmdline); STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE;
ZeroMemory(&pi, sizeof(pi)); CreateProcess(NULL, TEXT(cmdline), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); WaitForSingleObject(pi.hProcess, INFINITE); DWORD ret; GetExitCodeProcess(pi.hProcess, &ret); if (!ret) { MessageBoxA(NULL, "PSD大文件垃圾清理工具执行完成!", "(C) 版权所有 2018.08 Hongwenjun (蘭公子)", MB_OKCANCEL); } CloseHandle(pi.hProcess); CloseHandle(pi.hThread); return ret; }
|