if (bForce || !pEntry->hwnd){
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pEntry->dwProcessId);
if (hProcess == NULL){
return FALSE;
}
if (!TerminateProcess( hProcess, 1)){
// This function terminates the specified process and all of its threads
CloseHandle( hProcess );
return FALSE;
}
}
// kill the process
PostMessage(pEntry->hwnd, WM_CLOSE, 0, 0);
return TRUE;
}
The EnumWindows function enumerates all top-level windows on the screen by passing the handle of each window, in turn, to an application-defined callback function. EnumWindows continues until the last top-level window is enumerated or the callback function returns FALSE.
BOOL EnumWindows(
WNDENUMPROC lpEnumFunc, // pointer to callback function
LPARAM lParam // application-defined value
);
SendMessage(xx,WM_QUIT,0,0);
The ShowWindow function sets the specified window's show state.
BOOL ShowWindow(
HWND hWnd, // handle of window
int nCmdShow // show state of window
);