Communication between WinApi and hosted WinUI

youki 991 Reputation points
2022-05-10T07:45:14.54+00:00

Hello,
i have a few question for hosting a WinUI UI as an editor for my WinApi background app.

https://learn.microsoft.com/de-de/windows/apps/desktop/modernize/host-custom-control-with-xaml-islands-cpp

  1. Is there a possibility that I will have problems when I want the XAML UI to communicate with the WinApi part?
    (I want to save/ edit values in the XAML UI in a for i.e. resource file and tell the WinApi part to read the settings from the resource file [or may be a xml])
    1. Only WinUI 2 controls are supported? I will need listviews, dropdown boxes, radio buttons and something like a navigation view [slide menu], i won't have any problems there?
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.
720 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,411 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,516 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 81,446 Reputation points
    2022-05-10T08:08:58.84+00:00

    XAML Islands for WinUI 3 is not ready yet : 1-under-consideration
    (some XAML controls can be embedded like I explained in this thread, but it is just a workaround and not really usable)

    You should do the reverse, Win32 APIs in a WinUI 3 app
    (as unpackaged WinUI 3 apps are standard Win32 apps, you can do anything a C++/Win32 app can do)
    From what you wrote in other threads, you can put it in background (just no window), add a Tray icon with Shell_NotifyIcon, etc...


1 additional answer

Sort by: Most helpful
  1. youki 991 Reputation points
    2022-05-12T14:48:54.223+00:00

    Even if the memory consumption of the UI is very small, wouldn't it still be possible to free up the memory with WinUI as a component?
    The UI only serves as an editor and is rarely used (0.000001% of the time).

    Forget the following: *> Aha ok, i understand.

    I've just seen the message "This UWP process group is suspending processes to improve system performance" in the taskmanager for OneNote. So this is the default behaviour, if you minimize/close the UI in UWP (?!).*

    201544-image.png

    0 comments No comments