When I close the window, I want to pop up a the dialog that asks if I want to save my changes first.
Using this code and some Winforms magic I made it work.
var form = (Form)Form.FromHandle(handle);
form.Closing += ClosingForm;
But - only on WindowsDX. When I run the same thing on DesktopGL, Form.FromHandle returns null. On further inspection, Application.OpeForms has no forms at all, which makes me suspect DesktopGL uses something else. I don’t need this for Macos or for Linux, I just need a Windows-only solution for DesktopGL.