Home > Software engineering >  C off external process, I found the following function method, but I don't know how to fill in
C off external process, I found the following function method, but I don't know how to fill in

Time:10-10

C + + off external process, I found the following function method, but I don't know how to fill in the two entrance parameters, who can help me write a actual example, thank you,
 
BOOL KillProcess (LPCSTR pszClassName, LPCSTR pszWindowTitle)
{
HANDLE hProcessHandle;
ULONG nProcessID;
The HWND TheWindow;

TheWindow=: : FindWindow (NULL, pszWindowTitle);
: : GetWindowThreadProcessId (TheWindow, & amp; NProcessID);
HProcessHandle=: : OpenProcess (PROCESS_TERMINATE, FALSE,

NProcessID);
: : the TerminateProcess (hProcessHandle, 4);
return true;
}
reference
and

CodePudding user response:

Class name and window title, generally there is a window title line you can open the task manager and see what is usually off external process according to the process name (some process without the top-level window), through the CreateToolhelp32Snapshot snapshots and then traverse the matching process name in access to handle and then through the terminate closed, generally don't process external close it

CodePudding user response:

Parameters should be and FindWindow API meaning as

Respectively is window class name and window title

Specific can see: https://msdn.microsoft.com/en-us/library/ms633499 (vs. 85). Aspx

CodePudding user response:

Process of the main window class name and title bar
  • Related