创建进程
CString sCommandLine;
//wchar_t cWindowsDirectory[MAX_PATH];
wchar_t cCommandLine[MAX_PATH];
//DWORD dwExitCode;
PROCESS_INFORMATION pi;
STARTUPINFO si = {sizeof(si)};
sCommandLine=“C:\CATIA_New\win_b64\code\bin\Debug\ReadText.exe”;
::wcscpy(cCommandLine, sCommandLine);
// 启动""作为子进程
BOOL ret = CreateProcess(NULL, cCommandLine, NULL, NULL, FALSE, 0,NULL, NULL, &si, &pi);
if (ret)
{
// 关闭子进程的主线程句柄
CloseHandle(pi.hThread);
// 等待子进程的退出
WaitForSingleObject(pi.hProcess, INFINITE);
// 获取子进程的退出码
GetExitCodeProcess(pi.hProcess, &dwExitCode);
// 关闭子进程句柄
CloseHandle(pi.hProcess);
}
获取句柄发送消息
进程名称为Start_Computing
HWND hWnd = ::FindWindow(NULL,_T(“Start_Computing”));
::SendMessage(hWnd,WM_STOP_COUNT,0,0);
定义消息
定义消息
#defin