TerminateProcess: BOOL TerminateProcess( HANDLE hProcess, // handle to the process UINT uExitCode // exit code for the process );
得到一个窗口的进程IDGetWindowThreadProcessIdThe GetWindowThreadProcessId function retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window. DWORD GetWindowThreadProcessId( HWND hWnd, // handle to window LPDWORD lpdwProcessId // process identifier );
我想在一个某个exe中关掉这两个exe程序,怎么做?
BOOL TerminateProcess(
HANDLE hProcess, // handle to the process
UINT uExitCode // exit code for the process
);
但最好是为这个进程创建一个窗口,并用这个窗口接收一条结束自已的消息.也就是说用另外的Exe向这个Exe的窗口发送一条类似于WM_CLOSE这样的消息,让进程自然结束
BOOL TerminateProcess(
HANDLE hProcess, // handle to the process
UINT uExitCode // exit code for the process
);
HWND hWnd, // handle to window
LPDWORD lpdwProcessId // process identifier
);
OpenProcess
TerminateProcess