File tree Expand file tree Collapse file tree
source/MaaWin32ControlUnit/Screencap Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -305,6 +305,9 @@ bool FramePoolScreencap::init()
305305 // 尝试关闭截图时的鼠标指针(Windows 10 2004 及以上支持)
306306 try_disable_cursor ();
307307
308+ // 尝试包含从属窗口(弹窗、工具提示等)
309+ try_include_secondary_windows ();
310+
308311 try {
309312 cap_session_.StartCapture ();
310313 }
@@ -481,6 +484,28 @@ void FramePoolScreencap::try_disable_cursor()
481484 }
482485}
483486
487+ void FramePoolScreencap::try_include_secondary_windows ()
488+ {
489+ LogFunc;
490+
491+ using namespace winrt ::Windows::Foundation::Metadata;
492+
493+ if (!ApiInformation::IsPropertyPresent (
494+ L" Windows.Graphics.Capture.GraphicsCaptureSession" ,
495+ L" IncludeSecondaryWindows" )) {
496+ LogInfo << " IncludeSecondaryWindows property not supported on this system" ;
497+ return ;
498+ }
499+
500+ try {
501+ cap_session_.IncludeSecondaryWindows (true );
502+ LogInfo << " Secondary windows capture enabled successfully" ;
503+ }
504+ catch (const winrt::hresult_error& e) {
505+ LogWarn << " Failed to enable secondary windows capture" << VAR (e.code ()) << VAR (winrt::to_string (e.message ()));
506+ }
507+ }
508+
484509MAA_CTRL_UNIT_NS_END
485510
486511#endif
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ class FramePoolScreencap : public ScreencapBase
4242 bool check_and_handle_size_changed ();
4343 void try_disable_border ();
4444 void try_disable_cursor ();
45+ void try_include_secondary_windows ();
4546
4647private:
4748 HWND hwnd_ = nullptr ;
You can’t perform that action at this time.
0 commit comments