finder.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include <dwmapi.h>
  3. #include <string>
  4. #include <vector>
  5. #include <d3d11.h>
  6. class WindowFinder {
  7. public:
  8. struct Info {
  9. HWND hwnd = nullptr;
  10. std::wstring title;
  11. };
  12. static const std::vector<Info>& GetList(bool isUpdate = false);
  13. private:
  14. static std::vector<Info> _list;
  15. static std::wstring _GetWindowTextStd(HWND hwnd);
  16. static BOOL CALLBACK _EnumWindowsProc(HWND hwnd, LPARAM lParam);
  17. static bool IsAltTabWindow(HWND hwnd, const std::wstring& title);
  18. };
  19. class MonitorFinder {
  20. public:
  21. struct Info {
  22. HMONITOR monitor = nullptr;
  23. std::wstring title;
  24. RECT rect;
  25. };
  26. static const std::vector<Info>& GetList(bool isUpdate = false);
  27. private:
  28. static std::vector<Info> _list;
  29. static BOOL CALLBACK _MonitorEnumProc(
  30. HMONITOR hMonitor, // handle to display monitor
  31. HDC hdcMonitor, // handle to monitor-appropriate device context
  32. LPRECT lprcMonitor, // pointer to monitor intersection rectangle
  33. LPARAM dwData // data passed from EnumDisplayMonitors
  34. );
  35. };