diff --git a/README.md b/README.md index cf9869b..3f83e46 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,10 @@ Returns a `boolean` indicating if the window still exists Returns a `boolean` indicating if the window is visible +#### #isMinimized() + +Returns a `boolean` indicating if the window is minimized (iconic). + #### #getDimensions() Retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen. diff --git a/src/c++/window.cpp b/src/c++/window.cpp index c0d6dee..86af25b 100644 --- a/src/c++/window.cpp +++ b/src/c++/window.cpp @@ -99,6 +99,7 @@ Napi::Object Window::Init(Napi::Env env, Napi::Object exports) { InstanceMethod("getHwnd", &Window::GetHwnd), InstanceMethod("getDimensions", &Window::GetDimensions), InstanceMethod("isVisible", &Window::IsVisible), + InstanceMethod("isMinimized", &Window::IsMinimized), InstanceMethod("exists", &Window::Exists), InstanceMethod("getTitle", &Window::GetTitle), InstanceMethod("getClassName", &Window::GetClassName), @@ -237,6 +238,11 @@ Napi::Value Window::IsVisible(const Napi::CallbackInfo& info) { return Napi::Boolean::New(info.Env(), returned); } +Napi::Value Window::IsMinimized(const Napi::CallbackInfo& info) { + bool returned = IsIconic(this->_identifier); + return Napi::Boolean::New(info.Env(), returned); +} + Napi::Value Window::Exists(const Napi::CallbackInfo& info) { bool returned = IsWindow(this->_identifier); return Napi::Boolean::New(info.Env(), returned); diff --git a/src/c++/window.hpp b/src/c++/window.hpp index 97eaa71..3d1a63b 100644 --- a/src/c++/window.hpp +++ b/src/c++/window.hpp @@ -23,6 +23,7 @@ class Window : public Napi::ObjectWrap { Napi::Value GetHwnd(const Napi::CallbackInfo &info); Napi::Value GetDimensions(const Napi::CallbackInfo& info); Napi::Value IsVisible(const Napi::CallbackInfo& info); + Napi::Value IsMinimized(const Napi::CallbackInfo& info); Napi::Value Exists(const Napi::CallbackInfo& info); Napi::Value GetTitle(const Napi::CallbackInfo& info); Napi::Value GetClassName(const Napi::CallbackInfo& info);