1

When magnification API is initialized and the "MagSetFullscreenColorEffect" method is called, the screen automatically changes colors to match whatever array you called. This requires relatively little code:

InitializeComponent();
        if (!NativeMethods.MagInitialize())
        {
            NativeMethods.MagInitialize();
        }
NativeMethods.MagSetFullscreenColorEffect(Negative);

This immediately made the screen negative, implying that Magnification API is already creating a full screen click through window. I would like to know how I can get this window's handle, and reference it to change the color to a new array (IE, "NotNegative")

The below code demonstrates where I try to use the "GetForeGroundWindow" command to capture the Magnification API HWND, and then try to change the color of that window using the "MagSetColorEffect" method. This didn't work out. Questions:

  • How do I find the handle that Magnification API is using?
  • When does Windows API create this handle/window? During initalization, or in the magsetfullscreen method?
  • Why doesn't the below code change my window color?

NOTE: I know I can just change the color again using the MagnificationSetFullscreen. I also know I can create my own magnification window as demonstrated in Magnification API Overview. However, I am lazy, and would like to use the window it seems that the API is already creating.

  public MainWindow()
    {
        InitializeComponent();
        if (!NativeMethods.MagInitialize())
        {
            NativeMethods.MagInitialize();
        }

        Negative = new float[] {
            -1.0f,  0.0f,  0.0f,  0.0f,  0.0f ,
            0.0f,  -1.0f,  0.0f,  0.0f, 0.0f,
            0.0f,  0.0f,  -1.0f, 0.0f,  0.0f ,
            0.0f,  0.0f,  0.0f,  1.0f,  0.0f ,
            1.0f,  1.0f,  1.0f,  0.0f,  1.0f};


        NotNegative = new float[] {
            0.0f,  0.0f,  0.3f,  0.0f,  0.0f ,
            0.0f,  0.0f,  0.6f,  0.0f, 0.0f,
            0.0f,  0.0f,  0.1f, 0.0f,  0.0f ,
            0.0f,  0.0f,  0.0f,  1.0f,  0.0f ,
            0.0f,  0.0f,  0.0f,  0.0f,  1.0f}; 
        //NativeMethods.MagSetFullscreenColorEffect(Negative);

        hwndMag = NativeMethods.GetForegroundWindow();
       


        NativeMethods.MagSetColorEffect(hwndMag, NotNegative);

        NativeMethods.ShowWindow(hwndMag, 3);
    }

0 Answers0