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

Function close_alert_window_enum

src/engine/execnt.c:1168–1208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1166 */
1167
1168BOOL CALLBACK close_alert_window_enum( HWND hwnd, LPARAM lParam )
1169{
1170 char buf[ 7 ] = { 0 };
1171 PROCESS_INFORMATION const * const pi = (PROCESS_INFORMATION *)lParam;
1172 DWORD pid;
1173 DWORD tid;
1174
1175 /* We want to find and close any window that:
1176 * 1. is visible and
1177 * 2. is a dialog and
1178 * 3. is displayed by any of our child processes
1179 */
1180 if (
1181 /* We assume hidden windows do not require user interaction. */
1182 !IsWindowVisible( hwnd )
1183 /* Failed to read class name; presume it is not a dialog. */
1184 || !GetClassNameA( hwnd, buf, sizeof( buf ) )
1185 /* All Windows system dialogs use the same Window class name. */
1186 || strcmp( buf, "#32770" ) )
1187 return TRUE;
1188
1189 /* GetWindowThreadProcessId() returns 0 on error, otherwise thread id of
1190 * the window's message pump thread.
1191 */
1192 tid = GetWindowThreadProcessId( hwnd, &pid );
1193 if ( !tid || !is_parent_child( pi->dwProcessId, pid ) )
1194 return TRUE;
1195
1196 /* Ask real nice. */
1197 PostMessageA( hwnd, WM_CLOSE, 0, 0 );
1198
1199 /* Wait and see if it worked. If not, insist. */
1200 if ( WaitForSingleObject( pi->hProcess, 200 ) == WAIT_TIMEOUT )
1201 {
1202 PostThreadMessageA( tid, WM_QUIT, 0, 0 );
1203 WaitForSingleObject( pi->hProcess, 300 );
1204 }
1205
1206 /* Done, we do not want to check any other windows now. */
1207 return FALSE;
1208}
1209
1210
1211static 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