question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: How to migrate a simple Win32 app to WinUI 3.0

See original GitHub issue

I’m currently attempting to figure out how to port my Win32 application to WinUI 3.0. To better understand how basic things are done I’m trying to turn this Microsoft Win32 sample app into a C++/WinRT based WinUI 3.0 app.

To do so I have installed the Visual Studio WinUI 3.0 Project Templates and have created a new project from the “Blank App, Packaged (WinUI in Desktop)” template. However, there are many things that are unclear to me and I hope some kind soul might help me along with some hints. I stumbled over the following very basic issues:

  1. The wWinMain function in the mentioned sample sets up the message loop. Where do I need to set the message loop up in WinUI 3.0?
  2. Where would I attach the WndProc callback function that processes the messages?
  3. The sample draws on the window by obtaining an HDC using the GetDC function. How does this translate to WinUI 3.0? Am I able to draw into a window by simply obtaining the window’s HDC as well?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
janos-ijgyartocommented, Dec 20, 2020

Seconded. I also have an old Win32 project that I would like to boost using WinUI, and the sample linked by the OP covers most of the use cases involved. The documentation keeps pointing to XAML Islands, but there is no comprehensive guide that describes, from start to finish, how to take a legacy project (i.e without any configuration for WinUI) and setting it up to use WinUI.

5reactions
anawishnoffcommented, Dec 21, 2020

Most of our team is on holiday break now, but I’m hoping when we return in Jan someone from the engineering side will be able to answer your specific questions, @ackh. Sorry about the delay here.

@janos-ijgyarto - as for documentation for migrating apps to WinUI 3, I know that this is a gap in our documentation. This is something we’re hoping and aiming to provide at the WinUI 3.0 release, so stay tuned.

Read more comments on GitHub >

github_iconTop Results From Across the Web

User interface migration (including WinUI 3) - Windows apps
This topic shows how to migrate your user interface (UI) code, including migrating to the Windows UI Library (WinUI) 3.
Read more >
How to Upgrade a UWP Application to WinUI 3.0
In this post we'll look at a migration approach that will allow you to keep your UWP app running in parallel to a...
Read more >
Building Modern Desktop Apps with .NET and C - WinUI 3.0
NET Windows Developers to build a desktop application with C#. You can choose Windows ... WinUI 3.0 is an evolution of the UWP...
Read more >
Building Modern Desktop Apps—Is WinUI 3.0 the Way to Go?
WinUI 3.0 is the hot new framework for desktop application development. In this post we'll try to answer the questions “What is WinUI...
Read more >
Migrating Uno (UWP) application to WinUI 3.0
1 Answer 1 ... WCT (Windows Community Toolkit) packages are published under a different name for WinUI: they are named CommunityToolkit.WinUI.* ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found