Use OCR in Windows 10 quickly and easily with Text Grab. With optional background process and popups.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.6 KiB

  1. //// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  2. //// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  3. //// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  4. //// PARTICULAR PURPOSE.
  5. ////
  6. //// Copyright (c) Microsoft Corporation. All rights reserved
  7. #pragma once
  8. #include "PerMonitorDPIHelpers.h"
  9. using namespace System;
  10. using namespace System::Windows::Interop;
  11. using namespace System::Windows;
  12. using namespace System::Windows::Media;
  13. using namespace System::Security::Permissions;
  14. namespace NativeHelpers
  15. {
  16. public ref class PerMonitorDPIWindow : public Window
  17. {
  18. public:
  19. PerMonitorDPIWindow(void);
  20. event EventHandler^ DPIChanged;
  21. System::String^ GetCurrentDpiConfiguration();
  22. property double CurrentDPI
  23. {
  24. double get()
  25. {
  26. return m_currentDPI;
  27. }
  28. }
  29. property double WpfDPI
  30. {
  31. double get()
  32. {
  33. return m_wpfDPI;
  34. }
  35. void set(double value)
  36. {
  37. m_wpfDPI = value;
  38. }
  39. }
  40. property double ScaleFactor
  41. {
  42. double get()
  43. {
  44. return m_scaleFactor;
  45. }
  46. }
  47. protected:
  48. ~PerMonitorDPIWindow();
  49. [EnvironmentPermissionAttribute(SecurityAction::LinkDemand, Unrestricted = true)]
  50. void OnLoaded(Object^ sender, RoutedEventArgs^ args);
  51. void OnDPIChanged();
  52. void UpdateLayoutTransform(double scaleFactor);
  53. IntPtr HandleMessages(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, bool %handled);
  54. private:
  55. System::Boolean m_perMonitorEnabled;
  56. double m_currentDPI;
  57. double m_systemDPI;
  58. double m_wpfDPI;
  59. double m_scaleFactor;
  60. System::Windows::Interop::HwndSource^ m_source;
  61. };
  62. }