In windows, whether the process is started or not. In a recent project, you need to use the process status detection function. On the internet, there are three methods: 1. is to use GetExitCodeProcess (pi. hProcess, & dwExitCode); check whether the returned value of dwExitCode is STILL_ACTIVE or not. If it is still active, it indicates that it exists; 2. waitforsingleobject, determined by timeout. The specific implementation method can be checked online. 3. openprocess, which is determined by the return value. If the return value is NULL, it indicates that the process has been opened; otherwise, it has not been opened. The above three methods are all said by others, and some people say they have limitations. Let's talk about openprocess. In testing, we found that the thread was closed, but the return value was still NULL. Why ~~, There is no way to solve this problem in the most practical way. 4. check whether the process id matches the input table of the load system. If the process id matches, it indicates that the process is running. Otherwise, the process has crashed. The Code is as follows: # include <Tlhelp32.h> // if the process id is running, returns true of the Process, returns falsebool ProcessExist (DWORD process_id) {www.2cto.com PROCESSENTRY32 pe; DWORD id = 0; HANDLE hSnapshot = createconlhelp32snapshot (TH32CS_SNAPPROCESS, 0); pe. dwSize = sizeof (PROCESSENTRY32); if (! Process32First (hSnapshot, & pe) {CloseHandle (hSnapshot); return false;} while (1) {pe. dwSize = sizeof (PROCESSENTRY32); if (Process32Next (hSnapshot, & pe) = FALSE) {CloseHandle (hSnapshot); return false;} if (process_id = pe. th32ProcessID) {CloseHandle (hSnapshot); return true ;}}}