I am trying to use the UWP OCR API from a Win32 application. https://learn.microsoft.com/en-us/uwp/api/windows.media.ocr.ocrengine
I've succeeded in actually using it using it from both C#: https://blogs.windows.com/windowsdeveloper/2019/04/30/calling-windows-10-apis-from-a-desktop-application-just-got-easier/
and C++ using C++/WinRT
https://www.nuget.org/packages/Microsoft.Windows.CppWinRT/2.0.191217.1
in a Win32 application.
However, I cannot tell if this is or should be a supported scenario, or whether the documentation is up to date and accurate.
According to:
https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/desktop-to-uwp-supported-api
Windows.Media.Ocr.OcrEngine
Windows.Media.Ocr.OcrLine
Windows.Media.Ocr.OcrResult
Windows.Media.Ocr.OcrWord
are "APIs supported only in apps with package identity". However there is also this vague note:
"Occasionally, APIs in these areas may appear to function correctly. However, if an API is not explicitly listed as supported, you should avoid using it as it may have unintended side effects or behavior. Support for these APIs may become available in future releases. In the interim, your app should use relevant Win32 or .NET APIs instead."
Of course, there are no Win32 OCR apis....
There was a sample app available at some point but it was removed for some reason:
https://github.com/microsoft/cppwinrt/tree/february_2017_refresh/10.0.15042.0/Samples/Ocr