1 // Copyright 2023 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_WIN_WINDOW_ENUMERATOR_H_ 6 #define BASE_WIN_WINDOW_ENUMERATOR_H_ 7 8 #include <string> 9 10 #include "base/base_export.h" 11 #include "base/functional/callback.h" 12 #include "base/win/windows_types.h" 13 14 namespace base::win { 15 16 // Enumerates immediate child windows of `parent`, running `filter` for each 17 // window until `filter` returns true. 18 using WindowEnumeratorCallback = base::RepeatingCallback<bool(HWND hwnd)>; 19 BASE_EXPORT void EnumerateChildWindows(HWND parent, 20 WindowEnumeratorCallback filter); 21 22 // Returns true if `hwnd` is an always-on-top window. 23 BASE_EXPORT bool IsTopmostWindow(HWND hwnd); 24 25 // Returns true if `hwnd` is a system dialog. 26 BASE_EXPORT bool IsSystemDialog(HWND hwnd); 27 28 // Returns true if `hwnd` is a window owned by the Windows shell. 29 BASE_EXPORT bool IsShellWindow(HWND hwnd); 30 31 // Returns the class name of `hwnd` or an empty string on error. 32 BASE_EXPORT std::wstring GetWindowClass(HWND hwnd); 33 34 // Returns the window text for `hwnd`, or an empty string on error. 35 BASE_EXPORT std::wstring GetWindowTextString(HWND hwnd); 36 37 } // namespace base::win 38 39 #endif // BASE_WIN_WINDOW_ENUMERATOR_H_ 40