1

I created a window through CreateWindowEx in a WinUI 3 application, so I didn't have a Window object at first.

Using the window handle, I'm able to get WindowId and thus AppWindow. However, I couldn't find any document on how to get Window other than declare it directly. https://github.com/ACGNnsj/WinUI3CppWinRTDemo/blob/3477dedd9404e15689278aa9c2eab734fae20316/OCR/MainWindow.xaml.cpp#LL88C3-L88C8

Ax1le
  • 6,563
  • 2
  • 14
  • 61
ACGMN
  • 9
  • 3
  • You can't get a WinUI3 Window from a Win32 Window (handle). You must create a WinUI3 Window first, and then you can get its handle. – Simon Mourier May 10 '23 at 06:53

1 Answers1

0

There is no existed winrt::Microsoft.UI.Xaml::Window which associates with the native window in your sample.

Also, there is no APIs to get the associated winrt::Microsoft::UI::Xaml::Window from the native window or WindowId as @SimonMourier and the question said.

I have submitted a feature request about this. You can also submit an issue at WindowsAPPSDK GitHub Issues.

YangXiaoPo-MSFT
  • 1,589
  • 1
  • 4
  • 22