title: WinAPI. Check if window resizing has been finished
body: <p>I've got C++ application (used for share application's window via network). I need to update application's area on client side when it's size was changed on server side. For this purpose once in a period of time I call <code>GetWindowPos</code> to check if the window was resized. But I don't want to send the info when the window is in resizing state and send the info only when resizing is completed. I noticed that on Windows 8.1 and Windows 10 <code>GetWindowPos</code> returns same values when the window is in resizing state, however on Windows 7 it returns different values when the window is in resizing state. So the question is how to understand if window is in resizing state?</p>
  
  <p><strong>UPD</strong>: Implementation of <code>WM_ENTERSIZEMOVE</code> - <code>WM_EXITSIZEMOVE</code> variant</p>
  
  <pre><code>void WindowsDisplayHelperMasterWindow::SetMsgHook()
  {
      m_pThis = this;
      m_msgHook = SetWindowsHookEx(WH_GETMESSAGE, MsgPoc, NULL, 0);
  }
  </code></pre>
  
  <p>Static function that call non-static method of the class:</p>
  
  <pre><code>LRESULT CALLBACK WindowsDisplayHelperMasterWindow::MsgPoc(int code, WPARAM wParam, LPARAM lParam)
  {
      if (m_pThis != nullptr)
      {
          return m_pThis-&gt;GetMsgProcHook(code, wParam, lParam);
      }
      return CallNextHookEx(0, code, wParam, lParam);
  }
  </code></pre>
  
  <p>Hook function:</p>
  
  <pre><code>LRESULT CALLBACK WindowsDisplayHelperMasterWindow::GetMsgProcHook(int code, WPARAM wParam, LPARAM lParam)
  {
      if (code &lt; 0)
      {
          return CallNextHookEx(0, code, wParam, lParam);
      }
      MSG* lpmsg = (MSG*)lParam;
      if (lpmsg-&gt;hwnd != m_windowHandle)
      {
          return CallNextHookEx(0, code, wParam, lParam);
      }
      if (lpmsg-&gt;message == WM_ENTERSIZEMOVE &amp;&amp; !m_isWindowResizing)
      {
          m_isWindowResizing = true;
      }
      else if (lpmsg-&gt;message == WM_EXITSIZEMOVE &amp;&amp; m_isWindowResizing)
      {
          m_isWindowResizing = false;
      }
  
      return CallNextHookEx(0, code, wParam, lParam);
  }
  </code></pre>
  
  <p><code>m_pThis</code> and <code>m_msgHook</code> are static class members:</p>
  
  <pre><code>WindowsDisplayHelperMasterWindow* WindowsDisplayHelperMasterWindow::m_pThis = nullptr;
  HHOOK WindowsDisplayHelperMasterWindow::m_msgHook = NULL;
  </code></pre>
  
  <p>And here is the check itself:</p>
  
  <pre><code>if (!m_displayMode.IsEqualGeometry(displayMode) &amp;&amp; !m_isWindowResizing)
  {
      DUMPER_DEBUG("DS_ERROR_MODE_CHANGED");
      return DS_ERROR_MODE_CHANGED; // depending on this value server asks client to update application's window area
  }
  </code></pre>
  
  <p>Thanks.</p>