MCPcopy Create free account
hub / github.com/boostorg/build / close_alert_window_enum

Function close_alert_window_enum

v2/engine/execnt.c:1037–1077  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1035 */
1036
1037BOOL CALLBACK close_alert_window_enum( HWND hwnd, LPARAM lParam )
1038{
1039 char buf[ 7 ] = { 0 };
1040 PROCESS_INFORMATION const * const pi = (PROCESS_INFORMATION *)lParam;
1041 DWORD pid;
1042 DWORD tid;
1043
1044 /* We want to find and close any window that:
1045 * 1. is visible and
1046 * 2. is a dialog and
1047 * 3. is displayed by any of our child processes
1048 */
1049 if (
1050 /* We assume hidden windows do not require user interaction. */
1051 !IsWindowVisible( hwnd )
1052 /* Failed to read class name; presume it is not a dialog. */
1053 || !GetClassNameA( hwnd, buf, sizeof( buf ) )
1054 /* All Windows system dialogs use the same Window class name. */
1055 || strcmp( buf, "#32770" ) )
1056 return TRUE;
1057
1058 /* GetWindowThreadProcessId() returns 0 on error, otherwise thread id of
1059 * the window's message pump thread.
1060 */
1061 tid = GetWindowThreadProcessId( hwnd, &pid );
1062 if ( !tid || !is_parent_child( pi->dwProcessId, pid ) )
1063 return TRUE;
1064
1065 /* Ask real nice. */
1066 PostMessageA( hwnd, WM_CLOSE, 0, 0 );
1067
1068 /* Wait and see if it worked. If not, insist. */
1069 if ( WaitForSingleObject( pi->hProcess, 200 ) == WAIT_TIMEOUT )
1070 {
1071 PostThreadMessageA( tid, WM_QUIT, 0, 0 );
1072 WaitForSingleObject( pi->hProcess, 300 );
1073 }
1074
1075 /* Done, we do not want to check any other windows now. */
1076 return FALSE;
1077}
1078
1079
1080static void close_alert( PROCESS_INFORMATION const * const pi )

Callers

nothing calls this directly

Calls 1

is_parent_childFunction · 0.85

Tested by

no test coverage detected