Live data from Hacker News

Writing GUI apps for Windows is painful

tulach.cc

211–220 of 577 posts

Re: Writing GUI apps for Windows is painful

#211
I tried to write a windows App recently (maybe to put in the windows store). I gave up when ...

- Tried to wade through the mess of different frameworks. Some are abandoned, they all have different feature sets etc...

- I found that I could not have anything other than FullTrust (all permissions) if my app wanted to use the/live in the system tray.

- You can't set the size of the window to match the content. You can set a size, sort of, but the min is 500x500 AND it will remember what the user's last size was so if they e.g. maximize it will be the next time its opened regardless of the program settings. In order to do this simple thing I would have to write it as a WPF app with a installer (which as of 2023 can go on the Windows Store)

Re: Writing GUI apps for Windows is painful

#213

It strikes me that having the C++ requirement is part of what makes this difficult. I'd like to have seen some reasoning why not to just use C#. Seems like it could have made some things easier, especially given the author's praise of XAML and acceptance of Visual Studio. I'm not saying C# is better than C++, but just that choosing one over the other does have an impact.

> It strikes me that having the C++ requirement is part of what makes this difficult. It doesn't. In fact, it makes the problem even easier to solve due to the options that are already on the table. Virtually all .NET-based frameworks support C++ besides C#, specially WinUI3.

WinUI support for C++ is a travel back to the days of writing COM in Visual C++ 6.0 with ATL, only for a special bread of developers.

Re: Writing GUI apps for Windows is painful

#214

For requirements like that, I typically write WPF C# frontend, combined with C++ backend. Compared to ImGui, in WPF you’ll get a GUI designer, styling which allows easy dark mode, data bindings, data templates, animations, IDE support like live visual tree inspector, accessibility support, and more. If you use the legacy .NET 4 framework, the .NET runtime will come pre-installed on modern Windows. If you compile your…

WPF has been superseded (supposedly) by UWP / WinGUI / MAUI / Blazor?

Nope, the GUI story is so bad, that at BUILD 2024, WPF was made again an official Windows GUI framework for .NET devs, see BUILD 2024 sessions regarding Windows programming.

Re: Writing GUI apps for Windows is painful

#215

Unlike Windows, Apple and Android have managed to publish modern UI libraries for their own platforms - but in both cases, this involved migrating the whole platform to a new programming language (Swift and Kotlin, respectively). If I remember right, C# also has a few features which were only added to make Windows Forms and WPF more ergonomic. I'm starting to suspect that general-purpose languages just aren't flexibl…

The explanation is easy, the usual WinDev versus DevDiv politics.

Re: Writing GUI apps for Windows is painful

#216

Earlier quoted context omitted.

> That's not a problem, it's a feature. 1000 times this. I want software I'm running to look like the rest of the OS (and every other application) and respect my OS-level UI preferences. In the case of Win32 using the OS primitive controls mean that your application gets tons of accessibility and preference features "for free" (albeit Microsoft has done a good job in later Windows releases of removing the functionali…

You seem to be in the minority with that thought. The evidence is that most apps nowadays comes with their own style, often packed in a HTML frontend. Users are used of websites which all have their own designs, and don't seem to mind if all apps have different look and feel.

Devs that learned web frontend dev are not familiar with OS GUI guidelines. When I tell them Apple used to publish GUI guidelines for Mac application developers they stare at me in disbelief.

Re: Writing GUI apps for Windows is painful

#217

Unlike Windows, Apple and Android have managed to publish modern UI libraries for their own platforms - but in both cases, this involved migrating the whole platform to a new programming language (Swift and Kotlin, respectively). If I remember right, C# also has a few features which were only added to make Windows Forms and WPF more ergonomic. I'm starting to suspect that general-purpose languages just aren't flexibl…

The issue is the React paradigm, which is a bit questionable to begin with. It's a sort of fake OOP in a trenchcoat pretending to be something else, whilst abusing the language in ways that requires compiler plugins. My experiences with Compose and SwiftUI have been ... not that great. I kinda wish people would just have kept investing in their OOP toolkits.

You're right that reactive UI is a poor fit for most languages (especially JavaScript!), but I think the problem is more general than that.

Good UI architecture needs some convenient and efficient way to propagate state changes between different parts of the UI framework [0]. This requirement sits in an awkward place, halfway between imperative programming and functional programming. It just isn't in the day-to-day vocabulary of any mainstream language, not even modern imperative languages which have a bit of functional programming mixed in.

I don't think OOP is any better at fulfilling this requirement. Being able to offload half of your program into a visual editor is nice, but it's cold comfort if the other half of your program ends up being a tangled mess of callbacks and data binding.

[0]: https://raphlinus.github.io/ui/druid/2019/11/22/reactive-ui....

Re: Writing GUI apps for Windows is painful

#218

Earlier quoted context omitted.

runFullTrust apps are still subject to file system and registry redirection as well as various capability checks. Running fully unencumbered requires restricted capabilities that only Microsoft can approve.

you can turn some of that crap off: https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/ua...

Note the warning on the page.

> This element requires the unvirtualizedResources restricted capability.

And if you click through the restricted capability link:

> If your app declares any restricted capabilities, then you must provide info during the app submission process in order to be approved to publish your app to the Microsoft Store.

Re: Writing GUI apps for Windows is painful

#219

Earlier quoted context omitted.

runFullTrust apps are still subject to file system and registry redirection as well as various capability checks. Running fully unencumbered requires restricted capabilities that only Microsoft can approve.

You can opt out of those with manifest metadata. Capabilities aren't enforced if you distribute out of the app store.

The OS will enforce them at installation/launch time regardless of distribution method.

Re: Writing GUI apps for Windows is painful

#220
One thing I learned about the software industry is that a lot of the tools we use are objectively horrible, but it doesn't matter because somehow big tech manages to shove it in our faces anyway.

Also, the inverse that really good software tools often don't see the light of day is also true. It really doesn't matter if some tool is good or bad for adoption. What matters is; does it have the backing of big tech? It shows that tech media is completely monopolized.

Post reply on HN