void RunMesProgram() { CString strFilepath; strFilepath.Format("%sMesUpload.exe",GetModuleFolder()); HINSTANCE hNewExe = ShellExecute(NULL, "open", _T(strFilepath), NULL, NULL, SW_SHOWNORMAL); if ((DWORD)hNewExe <= 32) { SaveTempLg("程序启动失败:" + strFilepath); } } int KillProcessByWinTitle( LPCSTR pszWindowTitle) { HANDLE hProcessHandle; ULONG nProcessID; HWND TheWindow; TheWindow = ::FindWindow( NULL, pszWindowTitle ); ::GetWindowThreadProcessId( TheWindow, &nProcessID ); hProcessHandle = ::OpenProcess( PROCESS_TERMINATE, FALSE, nProcessID); return ::TerminateProcess( hProcessHandle, 4 ); } void KillProcessByName(CString name) { CString strCmd; strCmd = "taskkill /f /t /im " + name; WinExec(strCmd, SW_HIDE); }