WINAPI magnification.h functions not defined in MinGW?

74 Views Asked by At

I'm trying to compile the MagnifierSample.cpp from the Microsoft github with GCC (13.2.0) (MinGW w64).

Here are the includes and the WinMain() function that uses the Magnification API

// Ensure that the following definition is in effect before winuser.h is included.
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501    
#endif

#include <windows.h>
#include <wincodec.h>
#include <magnification.h>

int APIENTRY WinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE /*hPrevInstance*/,
                     _In_ LPSTR     /*lpCmdLine*/,
                     _In_ int       nCmdShow)
{
    if (FALSE == MagInitialize())
    {
        return 0;
    }
    if (FALSE == SetupMagnifier(hInstance))
    {
        return 0;
    }

    ShowWindow(hwndHost, nCmdShow);
    UpdateWindow(hwndHost);

    // Create a timer to update the control.
    UINT_PTR timerId = SetTimer(hwndHost, 0, timerInterval, UpdateMagWindow);

    // Main message loop.
    MSG msg;
    while (GetMessage(&msg, NULL, 0, 0))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    // Shut down.
    KillTimer(NULL, timerId);
    MagUninitialize();
    return (int) msg.wParam;
}

I get all these errors:

magnifiersample.cpp:82:18: error: 'MagInitialize' was not declared in this scope; did you mean 'OleInitialize'?
magnifiersample.cpp:107:5: error: 'MagUninitialize' was not declared in this scope; did you mean 'OleUninitialize'?
magnifiersample.cpp:210:28: error: 'WC_MAGNIFIER' was not declared in this scope
magnifiersample.cpp:211:20: error: 'MS_SHOWMAGNIFIEDCURSOR' was not declared in this scope
magnifiersample.cpp:225:16: error: 'MagSetWindowTransform' was not declared in this scope
magnifiersample.cpp:238:15: error: 'MagSetColorEffect' was not declared in this scope
magnifiersample.cpp:283:5: error: 'MagSetWindowSource' was not declared in this scope

It doesn't complains about finding the magnification.h file.

Edit: I looked at the magnification.h file from MinGW and it does not have function declarations for the functions in the Microsoft magnification API:

/**
 * This file has no copyright assigned and is placed in the Public Domain.
 * This file is part of the mingw-w64 runtime package.
 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
 */

#ifndef _INC_MAGNIFIER
#define _INC_MAGNIFIER

#include <winapifamily.h>

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)

#include <wincodec.h>

#define MW_FILTERMODE_EXCLUDE 0
#define MW_FILTERMODE_INCLUDE 1

typedef struct tagMAGTRANSFORM {
    float v[3][3];
} MAGTRANSFORM, *PMAGTRANSFORM;

typedef struct tagMAGIMAGEHEADER {
    UINT width;
    UINT height;
    WICPixelFormatGUID format;
    UINT stride;
    UINT offset;
    SIZE_T cbSize;
} MAGIMAGEHEADER, *PMAGIMAGEHEADER;

typedef struct tagMAGCOLOREFFECT {
    float transform[5][5];
} MAGCOLOREFFECT, *PMAGCOLOREFFECT;

#endif
#endif

Why is this? What should / can I do to use this API with MinGW?

0

There are 0 best solutions below