Not able to receive UWP app window handle in C++ library integrated through winRT
We are trying to build C++ library which is integrated in an UWP application using WinRT wrapper component.
In the library, we are trying to call the WebAuthNAuthenticatorMakeCredential API.
The API works fine in a C++ console app but we are not able to make the same API working in UWP app.
This API takes a HWND parameter as input . We have tried passing the widows handle of the UWP app but we get the below error message
0x8007109c
ERROR_NOT_SUPPORTED_IN_APPCONTAINER
This functionality is not supported in context of an app container
tried getting the hadnle in C++ using
HWND hWnd = GetActiveWindow();
also tried passing the handle from UWP using the below code
[ComImport, Guid("45D64A29-A63E-4CB6-B498-5781D298CB4F")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface ICoreWindowInterop
{
IntPtr WindowHandle { get; }
bool MessageHandled { set; }
}
dynamic corewin = Windows.UI.Core.CoreWindow.GetForCurrentThread();
var interop = (ICoreWindowInterop)corewin;
var handle = interop.WindowHandle;