C
C#2y ago
Ruttie

✅ Embedding an application WinUI 3

This may be a stupid question, but is it possible to have the UI of a different program be a component in my program? (I'm using WinUI 3)
10 Replies
Anchy
Anchy2y ago
I'm unsure of your question, do you mean is it possible to decouple your program from the UI? Then yes, you can write your program logic so that it has no awareness of the UI and is actually preferred so it can be UI agnostic.
Ruttie
Ruttie2y ago
No, I mean for example if you open a unity app or something similar that instead of a new window being created, it's ui is a part of my application (as a sort of ui element)
Anchy
Anchy2y ago
I know you can use the Win32 API to set software as a child of another process and have it behave in an MDI state. However I wouldn't know how to achieve that or if it's advisable as for embedding the software as a component, I don't think such a thing exists except for WindowsFormsHost for WPF & ElementHost for Winforms Is there any reason you can't just write the functionality into your application directly instead of hosting it?
Ruttie
Ruttie2y ago
writing a unity game that already exists again seems like a bad idea
Anchy
Anchy2y ago
Elaborate?
Ruttie
Ruttie2y ago
well if I'm trying to do this with for example a unity game, then that seems rather stupid plus applications would need to be built-in, adding custom applications wouldn't be possible
Anchy
Anchy2y ago
I'm still confused on what exactly you are trying to achieve by doing this? What are you trying to make if you don't mind me asking?
Ruttie
Ruttie2y ago
it's difficult to explain, but I can compare it to like how obs has a little preview thing, but instead of preview it's the actual window? idk
Anchy
Anchy2y ago
I don't think OBS embeds another application into the preview window so again it might be optimal to just write that code directly as part of your program logic
Ruttie
Ruttie2y ago
like I said, it's difficult to explain