Can we use both WinUI3 controls and Win32 controls in a WinUI3 application?

Harshithraj1871 1,536 Reputation points
2022-12-05T06:13:30.36+00:00

Hi,

I'm using WinUI3 application, As we can extract HWND from WinUI3 window, and we can attach Window Proc with SetWindowSubclass and manage WM_* messages, I was wondering if we can use Win32 controls and WinUI3 controls at the same time.

I was able to pop a Win32 messagebox on an event, but I was not able to use controls like static and edit text to display data on screen along with WinUI3 controls.

It would be great if you could help me in using both WinUI3 controls and Win32 controls in a WinUI3 application.

Thank you

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
798 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,666 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,774 questions
{count} votes

Accepted answer
  1. Castorix31 86,046 Reputation points
    2022-12-05T07:55:17.657+00:00

    Yes, you can create Win32 controls in WinUI 3 apps with CreateWindowEx
    I often use them as container in samples I uploaded on GitHub, like in MainWindow.xaml.cs or ContainerPanel.xaml.cs

    3 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.