Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are there any examples showing a WinUI application developed using windows-rs? #2971

Closed
tmheath opened this issue Apr 4, 2024 · 11 comments
Closed
Labels
question Further information is requested

Comments

@tmheath
Copy link

tmheath commented Apr 4, 2024

Suggestion

Proceeding from finding this comment I looked for an examples directory but didn't see it, is there one? Background: Trying to get a gui running because it looks like the captureobjectpicker requires a WinUI root window that I haven't seen how to create and not a win32 window to hook it's events into. I did post an actual question to the Microsoft link from the issues tab for a separate issue which does belong in the Microsoft Q&A but that site is a bit broken.

@tmheath tmheath added the enhancement New feature or request label Apr 4, 2024
@tmheath
Copy link
Author

tmheath commented Apr 4, 2024

I might be able to get something running if this is still valid.

@ChrisDenton
Copy link
Collaborator

I think WinUI3 is very much limited to C# in practice (if not in theory)? Maybe it would be easier to create a thin C# UI wrapper that then invokes rust functions?

@tmheath
Copy link
Author

tmheath commented Apr 4, 2024

It doesn't absolutely have to be WinUI3, I just need that new style root window object addressable from the rust code so that I can spot the picker dialog, I saw a single reference of a guy saying he got it running with rust in some comments just a bit ago but the specifics aren't important. It very well might be easier, I don't have the experience with the interrop there. Thanks for the response.

@riverar
Copy link
Collaborator

riverar commented Apr 4, 2024

We went down this road with https://github.com/microsoft/windows-app-rs. To quote from that:

The windows-app project was an experimental crate letting you call APIs from the Windows App SDK based on the technology from the windows crate. The Windows App SDK is however largely a vehicle for delivering out-of-band releases of Xaml, which is itself designed squarely for C# developers. While every effort has been made to support Rust, the Windows App SDK in its current form is too heavily tied to .NET and Visual Studio to be practically usable with other languages and toolchains. We hope this will change in future but for now this project has been archived.

@tmheath
Copy link
Author

tmheath commented Apr 4, 2024

Thank you for the answer @riverar, are win32 guis the only supported via rust at the moment (assuming they are then for what I'm doing I'm going to see if I can hook into a win32 processing loop for what's needed or as @ChrisDenton mentioned, run C# also)?

@riverar

This comment was marked as outdated.

@riverar
Copy link
Collaborator

riverar commented Apr 4, 2024

@robmikh has a great crate demonstrating usage of Windows.Graphics.Capture (https://github.com/robmikh/screenshot-rs). I suspect this will help!

@riverar riverar added question Further information is requested and removed enhancement New feature or request labels Apr 4, 2024
@tmheath
Copy link
Author

tmheath commented Apr 4, 2024

@riverar
Thank you very much for that, I already have the window HWNDs so this is completely perfect, just need to find the calls used in there.

For future reference if it's unclear, the answer was that the modern Windows GUI at the time of writing (xaml via WinUI3) only supports C# (I have used it with F# but besides the point).

@tmheath tmheath closed this as completed Apr 4, 2024
@riverar
Copy link
Collaborator

riverar commented Apr 4, 2024

@tmheath Can you also mark the answer I provided on Q&A to close this all out? Thanks!

@robmikh
Copy link
Member

robmikh commented Apr 4, 2024

I'd also like to point out that many WinRT pickers that assume a CoreWindow can be used by QIing for IInitializeWithWindow and providing an HWND before showing the picker. This includes the GraphicsCapturePicker.

@tmheath
Copy link
Author

tmheath commented Apr 4, 2024

@tmheath Can you also mark the answer I provided on Q&A to close this all out? Thanks!

The microsoft Q&A site?
The question I know I left does not show any answers to me, but I know there was a problem where I had to create twice because the first left me at a 404 page, did you answer the first and I just don't see it or is it not even that one you're talking about?

Will do soon as I see, also thanks

@robmikh, That's really nice for reference somewhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants