add show and hide window function

This commit is contained in:
MistEO
2021-07-13 23:10:32 +08:00
parent 3a4d2e430d
commit 92a531b43a
3 changed files with 22 additions and 0 deletions

View File

@@ -17,6 +17,8 @@ namespace asst {
bool captured() const noexcept;
bool resizeWindow(int Width, int Height);
bool resizeWindow(); // by configer
bool showWindow();
bool hideWindow();
bool click(const Point & p);
bool clickRange(const Rect & rect);
cv::Mat getImage(const Rect& rect);

View File

@@ -22,6 +22,8 @@ Assistance::Assistance()
Assistance::~Assistance()
{
m_pWindow->showWindow();
m_thread_exit = true;
m_thread_running = false;
m_condvar.notify_one();

View File

@@ -93,6 +93,24 @@ bool WinMacro::resizeWindow()
return resizeWindow(m_width, m_height);
}
bool WinMacro::showWindow()
{
if (m_handle_type != HandleType::Window) {
return false;
}
return ::ShowWindow(m_handle, SW_SHOW);
}
bool WinMacro::hideWindow()
{
if (m_handle_type != HandleType::Window) {
return false;
}
return ::ShowWindow(m_handle, SW_HIDE);
}
double WinMacro::getScreenScale()
{
static double scale = 0;