diff --git a/webrtc/modules/desktop_capture/window_capturer_win.cc b/webrtc/modules/desktop_capture/window_capturer_win.cc index ba45eaa9d1..322a5340c9 100644 --- a/webrtc/modules/desktop_capture/window_capturer_win.cc +++ b/webrtc/modules/desktop_capture/window_capturer_win.cc @@ -13,6 +13,7 @@ #include #include "webrtc/base/scoped_ptr.h" +#include "webrtc/base/checks.h" #include "webrtc/base/win32.h" #include "webrtc/modules/desktop_capture/desktop_frame_win.h" #include "webrtc/modules/desktop_capture/win/window_capture_utils.h" @@ -39,13 +40,26 @@ BOOL CALLBACK WindowsEnumerationHandler(HWND hwnd, LPARAM param) { // Skip the Program Manager window and the Start button. const size_t kClassLength = 256; WCHAR class_name[kClassLength]; - GetClassName(hwnd, class_name, kClassLength); + const int class_name_length = GetClassName(hwnd, class_name, kClassLength); + RTC_DCHECK(class_name_length) + << "Error retrieving the application's class name"; + // Skip Program Manager window and the Start button. This is the same logic // that's used in Win32WindowPicker in libjingle. Consider filtering other // windows as well (e.g. toolbars). if (wcscmp(class_name, L"Progman") == 0 || wcscmp(class_name, L"Button") == 0) return TRUE; + // Windows 8 introduced a "Modern App" identified by their class name being + // either ApplicationFrameWindow or windows.UI.Core.coreWindow. The + // associated windows cannot be captured, so we skip them. + // http://crbug.com/526883. + if (rtc::IsWindows8OrLater() && + (wcscmp(class_name, L"ApplicationFrameWindow") == 0 || + wcscmp(class_name, L"Windows.UI.Core.CoreWindow") == 0)) { + return TRUE; + } + WindowCapturer::Window window; window.id = reinterpret_cast(hwnd);