question

RahulK-5396 avatar image
0 Votes"
RahulK-5396 asked ·

Can We access Win-32 APIs from WinUI-3 based UWP apps?

  • Difference between WinUI-2 and WinUI-3 says that WinUI-3 will work for win-32 also. Does that mean WinUi-3 can be used as UI for Win-32 apps or does that mean using WinUI-3 based UWP apps will we be able access win-32 apps(as normal UWP apps cannot access Win-32 APIs, my doubt is by using WinUI-3 based UWP apps will we get any add-on like access to Win-32 APIs also?)

  • Is the way of operation of WinUI-3 based UWP apps is completely different from normal UWP apps(Will there be different way of working like differences between UWP and WPF) ----(or)---

  • WinUI3 is just a UI loosely coupled from UWP(thinking normal UWP apps have UI tightly coupled with UWP)?

  • References: Differences of WinUI3 to Other Apps ,
    winui3 MS docs


windows-uwpwindows-uwp-xamlwindows-uwp-runtime
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

What Win32 APIs, in particular, were you looking to access? Depending on what they are, there may be WinRT alternatives.

There's a list available here which contains every Win32/COM API that can be used in your Universal app. If you need something that isn't on the list, then you need to use WinUI 3 Desktop to access those APIs, WinRT APIs, and leverage the XAML UI stack.

It's worth noting that this version of WinUI is not available yet, but will be soon. Also, WinUI Desktop is not intended to be Universal, as it's Windowing technology won't use CoreWindow. Make sure to keep these differences in mind when deciding what's right for your app.


0 Votes 0 ·
Alienator-7373 avatar image
0 Votes"
Alienator-7373 answered ·

Not exactly. If you create an app that's specifically a "Universal" app, then no, you will not have access to win32 APIs, with or without WinUI 3.0.

However, you can create WPF or WinForms apps that make use of "Xaml Islands". Xaml Islands allow you to host UWP controls. Therefore, you will be able to host WinUI 3.0 controls in your WPF/WinForms app while also making use of win32 APIs.

There is also a rumored "Xaml Desktop" format that will come out alongside WinUI 3.0. This is expected to allow you to create Visual Studio projects with WinUI as the main UI framework while supporting win32 without having to use Xaml Islands. There's not much detail on how this will work yet, but we know that this will not be considered a true universal app (meaning you can only create these apps for desktop).

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

jtorjo avatar image
0 Votes"
jtorjo answered ·

I suggest you post this here: https://github.com/microsoft/microsoft-ui-xaml

Also, read through the discussions there - there's a lot of info that will explain quite a bit.

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Ok, thanks.

0 Votes 0 ·