Hello,
In a project in C++ WinUI 3, I have a problem to create two windows at the same time. I reduce the problem to narrow down and I realize that I can't create two objects Window in the same function. For example, if I have an event when a button is clicked like this:
void MainWindow::ClickButton(IInspectable const&, RoutedEventArgs const&)
{
w1 = Window();
w2 = Window();
}
Obviously I'm simplified the code for clarity. w1 and w2 are variables of type IWindow members of class MainWindow.
The avove code fails with an unmanaged exception. The function run perfectly and return, but the exception is triggered.
If I create only one Window it work right. How to create two windows inside an event handler?
Thanks in advance!
What I have tried:
I tried activate both windows but no luk