WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

Proposal for future windowing mechanisms for Win32 apps

Open AzAgarampur opened this issue 5 years ago • 1 comments

Proposal: Win32 apps can use WinRT to create modern window frames.

Summary

UWP apps are launched with a window created for them by ApplicationFrameHost.exe. These are customized Win32 windows, of course. Win32 apps can use WinRT to customize a specific window via an HWND. Internally, it would probably take the window handle and take over window frame composition and create an application frame window that allows a Win32 app to host standard content inside of it.

Rationale

  • #1 reason why - windowing consistency across UWP apps and Win32 programs hosting XAML content. XAML content looks best when the proper window frame is being used.
  • #2 - provides easier ways to customize title bar buttons and color, as we can use the existing ApplicationViewTitleBar class.

API proposal

I was thinking we could update Windows/Microsoft.UI.Xaml.Window and add a function like AttachToWindow to allow the backend to take control of painting the window we give it via an HWND. We can then call DetatchFromWindow and pass in the previous HWND to stop compositing the modern window and allow the app to take back control customizing its window via the app's own WindowProc.

AzAgarampur avatar Sep 02 '20 08:09 AzAgarampur

#157

Poopooracoocoo avatar Sep 03 '20 05:09 Poopooracoocoo

Closing this feature proposal. UWP is out of scope for WinAppSDK. If the desire is to place WinUI3 content in a random HWND in a Win32 app, that is possible with Islands support (probably not as easy as we'd like yet, but that will continue to improve over time).

codendone avatar Feb 19 '25 18:02 codendone