From a17738e1545ff7dbef6398b8ec1eab93ab59c9a1 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 30 六月 2022 19:14:47 +0800 Subject: [PATCH] '功能完善' --- ConsoleApplication/CaptureUtil.cpp | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 deletions(-) diff --git a/ConsoleApplication/CaptureUtil.cpp b/ConsoleApplication/CaptureUtil.cpp index 1539ca6..c6f80f4 100644 --- a/ConsoleApplication/CaptureUtil.cpp +++ b/ConsoleApplication/CaptureUtil.cpp @@ -1,6 +1,6 @@ #include "CaptureUtil.h" -HWND CaptureUtil::frames[8]; +HWND CaptureUtil::level2Frames[8]; std::list<FrameInfo> CaptureUtil::tempFrames; BOOL CALLBACK CaptureUtil::EnumChildProc(HWND hwndChild, LPARAM lParam) { @@ -10,8 +10,9 @@ if (string(className) == "AfxWnd100s") { RECT rect; GetWindowRect(hwndChild, &rect); + bool show= IsWindowVisible(hwndChild); - if (rect.right - rect.left < 1000&& rect.right - rect.left>400) + if (show&&rect.right - rect.left < 1000&& rect.right - rect.left>400) { FrameInfo info = FrameInfo(); info.frame = hwndChild; @@ -32,18 +33,13 @@ } return TRUE; } -void CaptureUtil::init(std::string winName) { +void CaptureUtil::init(HWND l2win) { tempFrames.clear(); - HWND root = FindWindowA(NULL, winName.c_str()); + HWND root = l2win; root = FindWindowEx(root, NULL, TEXT("AfxFrameOrView100s"), NULL); EnumChildWindows(root, EnumChildProc, NULL); - - //TODO list排序 - - - //赋值 std::list<FrameInfo>::iterator ele; int index = 0; @@ -51,11 +47,11 @@ if (index > 7) { break; } - frames[index++] = (*ele).frame; + level2Frames[index++] = (*ele).frame; } } HWND CaptureUtil::getHWND(int index) { - return frames[index]; + return level2Frames[index]; } cv::Mat CaptureUtil::capture(int index) { -- Gitblit v1.8.0