1
0

ExternalWindowTracker.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include "Misc.h"
  3. class ExternalWindowTracker
  4. {
  5. public:
  6. ExternalWindowTracker(void);
  7. ~ExternalWindowTracker(void);
  8. HWND ActiveWnd() const { return m_activeWnd; }
  9. HWND FocusWnd() const { return m_focusWnd; }
  10. bool DittoHasFocus() const { return m_dittoHasFocus; }
  11. bool DesktopHasFocus() const { return m_desktopHasFocus; }
  12. CString ActiveWndName();
  13. CString WndName(HWND hWnd);
  14. bool TrackActiveWnd(bool force);
  15. bool ActivateTarget();
  16. bool ReleaseFocus();
  17. CPoint FocusCaret();
  18. void SendPaste(bool activateTarget);
  19. void SendCut();
  20. void SendCopy(CopyReasonEnum::CopyReason copyReason);
  21. bool NotifyTrayhWnd(HWND hWnd);
  22. protected:
  23. typedef HRESULT(__stdcall *AccessibleObjectFromWindow)(_In_ HWND hwnd, _In_ DWORD dwId, _In_ REFIID riid, _Outptr_ void** ppvObject);
  24. HWND m_activeWnd;
  25. HWND m_focusWnd;
  26. bool m_dittoHasFocus;
  27. bool m_desktopHasFocus;
  28. HMODULE m_hOleacc;
  29. AccessibleObjectFromWindow m_AccessibleObjectFromWindow;
  30. protected:
  31. bool WaitForActiveWnd(HWND hwndToHaveFocus, int timeout);
  32. void ActivateFocus(const HWND active_wnd, const HWND focus_wnd);
  33. };