June 30th, 2024

Writing GUI apps for Windows is painful

Samuel Tulach discusses challenges in writing Windows GUI apps in C++, emphasizing requirements like Windows support, styling, and efficiency. He evaluates various frameworks, recommending Dear ImGui for its simplicity and lightweight design.

Read original articleLink Icon
Writing GUI apps for Windows is painful

Samuel Tulach discusses the challenges of writing GUI apps for Windows in C++. He outlines requirements for Windows support, commercial use, easy styling, a single .exe file under 40MB, and efficient GUI development. He evaluates WinUI 3, Win32/MFC, Qt, wxWidgets, hikogui, Sciter, and WinForms/WPF, highlighting issues like dependencies, styling limitations, and complexity. Despite drawbacks, he recommends Dear ImGui for simple apps due to its small size, no dependencies, and DirectX integration for smooth UI rendering. ImGui's example project showcases multi-viewports for creating straightforward GUI apps efficiently. With a compiled size of 500KB and no need for additional installations, ImGui stands out for lightweight and straightforward GUI development on Windows.

Related

X debut 40 years ago (1984)

X debut 40 years ago (1984)

Robert W. Scheifler introduced the X window system in June 1984 for the VS100 Unix server, offering improved performance over W. The system was stable, with the Laboratory for Computer Science already transitioning to X and developing applications. Scheifler encouraged experimentation and welcomed volunteers for documentation contributions.

Let's write a video game from scratch like it's 1987

Let's write a video game from scratch like it's 1987

Philippe Gaultier created Minesweeper in 1987 using X11 without libraries, resulting in a compact executable. The article explores X authentication, Odin language usage, and minimalistic GUI development, offering insights into X11 intricacies. Source code is on GitHub.

Is 2024 the year of Windows on the Desktop?

Is 2024 the year of Windows on the Desktop?

In 2024, the author reviews Windows 11, highlighting challenges like limited hardware support, lack of installation control, manual driver search, slow updates, and UI lag. They compare favorably to Linux distributions.

U++ – Cross-Platform App Development Framework

U++ – Cross-Platform App Development Framework

U++ is a C++ framework for rapid application development, featuring GUI and SQL libraries, TheIDE, and support for various compilers. It aims to enhance C++ productivity across multiple platforms.

Chris Titus Tech's Windows Utility – Install Programs, Tweaks, Fixes and Updates

Chris Titus Tech's Windows Utility – Install Programs, Tweaks, Fixes and Updates

A GitHub repository offers Chris Titus Tech's Windows Utility for Windows tasks optimization. Admin mode is required for system-wide changes. Features include program management, tweaks, issue fixing, and update control. Visit the repository for more.

Link Icon 108 comments
By @Aurornis - 5 months
This is a good overview of some of the options, but the author’s specific requirements push it in a specific direction that eliminates a lot of options.

Specifically, the requirement for completely custom GUI styling without writing his own render functions means it’s really a task of selecting easy, customizable GUI libraries rather than generic GUI work.

The requirements to be self-contained executables and under a 40MB limit also rule out a lot of options. The author admits that Qt could have met these requirements but the open-source licensing part wasn’t compatible with his goals and he didn’t want to pay for a license.

If you relax the requirements to tolerate some dependencies, allow larger download sizes, or to simply use built-in Windows GUI controls the situation is very different.

For writing a lightweight, completely custom GUI with no external dependencies and permissive licensing I could have guessed ImGui would be the answer before I started reading.

By @Lariscus - 5 months
I have a very low opinion of developers who decry having to pay for a commercial licence for otherwise LGPL licensed software libraries. They expect to be paid for their work, and ensure that by creating closed source software. That's fair enough. Yet, the devs that solved the actually difficult parts of creating a UI library have to be utter saints who freely bestow a gift of code upon the world.
By @alkonaut - 5 months
While it’s a bit cumbersome, he doesn’t really point out any major flaw with the WinForms/WPF ideas, other than of course requiring two stacks. He says he wants native code and wouldn’t want any C# visible but doesn’t explain why. Fear of reverse engineering? UI code rarely contains anything secret.

Also the single exe deployment, while convenient at times, is perhaps not worth the hassle in this scenario. Using a packager like Velopack (squirrel) makes it a single exe to distribute and as an added bonus makes it self updating. That it has two or more files on disk when installed seems like a good tradeoff.

Windows is the worst platform to develop desktop apps for, apart from all the others.

By @c-smile - 5 months
As of Sciter and "antialiasing" issues mentioned in the article...

Author did not enable high-DPI support in his/her application. As simply as that...

Either in Visual Studio : https://sciter.com/wp-content/uploads/2024/06/high-dpi-aware...

Or by including proper manifest: https://gitlab.com/sciter-engine/sciter-js-sdk/-/blob/main/d...

That actually is explained in "Hello C++" tutorial: https://sciter.com/hello-cpp-tutorial/

By @throwaway2037 - 5 months
Reading many of these comments makes me realise that the whole premise is flawed. I "vote" to rename this blog post as:

    > Writing GUI apps for Windows is painful when requirements are unrealistic
They should try to target .NET Framework 3.5 using WinForms. That is my best suggestion, as all recent versions of Windows will have this installed (at least).
By @ogoffart - 5 months
I'm working on a GUI toolkit that should match the requirements: Slint - https://slint.dev Can be compiled statically in a single .exe that is smaller than 40M. Has a license that allow proprietary on desktop for free. Has dark/light styles. Even comes with a (work in progress) drag and drop WYSISYG editor.
By @api - 5 months
Writing GUI apps is painful period, and it’s become more so not less in the last two decades.

Go back in an emulator some time and try Visual Studio or even old Borland from the 1990s. Point, click, add code, set style, and the result was not bad at all. The whole UI looked consistent too with uniform controls, shortcuts, etc.

Today UI apps use 100X more memory, are slower, and are harder to use with little to show for it in terms of improved functionality. The whole desktop is a disaster of conflicting designs and accessibility or uniformity are practically gone.

Mobile is kind of shocking too. Here was a chance to dump cruft from desktop and do things better but the result really is just as much of a pain in the arse if not more. Consistency is a little better but the developer experience is awful and of course unlike desktop you really can’t develop on the actual device. That adds another layer of shit.

By @markasoftware - 5 months
More accurately:

+ "portable" (single exe with no automatic unzipping of dlls or anything)

+ commercial and unwilling to redistribute compiled object files (which together with the "portable" requirement, means no LGPL)

+ dark mode

Windows GUI apps is painful. Drop any one of these requirements and there are good established options.

Specifically I think most "portable" applications use win32 because, usually, portable => small, simple application where functionality is more important than dark mode or other styling ability.

By @bonestamp2 - 5 months
> Writing the GUI part of the program should not take more time than the actual functionality

I don't understand why this is a rule. I mean, I don't know what the author is trying to build, but in general the GUI is the part that the users spends all of their time interacting with. I don't see why it would be a problem if a little more time was spent there.

By @markus_zhang - 5 months
I'm teaching myself the Win32 API for a future RE project, thinking that knowing it helps with the reverse engineering effort. I have just achieved creating a window, loading a text file and printing it on the main window. Scrollbars are there but don't work yet.

It actually take s a lot of work. The boilerplate code is OK but I never realized that showing strings on Windows is such a PIA. I have deep respect for anyone who wrote Windows GUI apps back in the late 80s -> early 90s before RAD is a thing.

As a side note. I recently got a book about WinG game programming on Windows 3.X/95. I remember back in the day the game Fury3, a fascinating 3d flight shooter game, was developed in WinG. It could be an interesting archeology project to develop something serious with WinG, the predecessor of DirectX.

By @Q6T46nT668w6i3m - 5 months
Apple and Microsoft underinvest in their widget toolkits. It’s especially damning for Apple since they spend the money to write numerous custom widgets (e.g., the widgets in their professional apps like Final Cut Pro and Logic Pro) but don’t upstream. Nobody is inspired by yet another implementation of button or tab widgets.
By @ZoomZoomZoom - 5 months
> uses native Win32 components and offers no styling options

It's a feature.

Custom styling should be considered a hostile pattern in most cases, except in highly specialized software with workflows dependent on prior user experience, such as DAWs.

By @pshirshov - 5 months
I had a similar struggle. I needed a truly cross-platform (Windows, Linux/Wayland, Mac, iOS, Android) GUI toolkit with rich controls library and reasonable theming. In fact, the only good option is QT and it's very hard to be productive with C++, it still lacks even basic features, like type deconstruction and ADTs/GADTs with exhaustiveness checks. QT bindings for other languages aren't mature enough.

Apart from QT, there is Avalonia, which is full of bugs. Linux support is remarkably bad.

Also there is Kotlin/Compose Multiplatform. It lacks good documentation, advanced controls and still full of bugs.

I was unable to find any good controls library for JS/TS, even paid ones (like Telerik and others) are pretty messy. So, Electron, Capacitor, React Native - they all assume a non-trivial effort to be put into even a very basic app.

Flutter feels extremely immature, and the strange popularity of global singletons makes it extremely hard to navigate even small codebases.

By @asveikau - 5 months
> It would require me to write a custom paint function for every single control, which would take so much time I could raise a family in the meantime

This is a weird comment that shows the philosophy of old school win32 has not clicked for them. The key element in win32 is the wndproc. Most controls ask their parent what color they should be via a window message.

If you find this inconvenient, wrapping that in a small library to remove boiler plate is not a big deal.

By @beart - 5 months
Writing GUI apps is painful everywhere, and has been for years.

I remember the half-baked transition from Windows Forms to WPF, which was then taken-over by the Windows Phone initiative, which was also extremely painful and half-baked.

There's a reason electron is so popular, despite all the complaints about it as a platform. Don't blame the electron devs, blame Microsoft for completely failing to support their own platform. That lack of long-term support and consistency extends to a ton of areas in the Windows world, not just GUI development.

By @Const-me - 5 months
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 C++ DLL with static C runtime, your C++ DLL won’t have any dependencies apart from OS components like kernel32.dll.

If you insist on having a single EXE you’ll need to bundle it and extract, but the additional code for the P/Invoke to work is like 4 lines of that code, call LoadLibraryW from kernel32.dll early on startup, before using any stuff with [DllImport] from that DLL.

I do not recommend C++ CLI. Write normal C++ which compiles into native code without any weird metadata. You can use C APIs, or COM interop with ATL, or check this library of mine https://github.com/Const-me/ComLightInterop/

If you start with this approach (as opposed to refactoring a C++ app you already have) you’ll find out that you need substantially less C++ than you expected. Essentially, C++ is only required for 2 things: CPU-bound number crunching, and code which consumes large C or C++ libraries (Windows SDK is huge and pieces like D3D or MediaFoundation require C++). It’s much easier to do everything else in C#, as the language and especially the standard library are just better.

By @fassssst - 5 months
Just use WinUI 3. Opting into MSIX packaging no longer requires an App Container sandbox.

More info here: https://learn.microsoft.com/en-us/windows/msix/desktop/deskt...

Full disclosure: I work at Microsoft.

By @daemin - 5 months
Like the author I too did an evaluation of various UI frameworks, though I ended up settling on WTL (Win32 with some ATL). I might switch away from it and make my own Win32 wrapper in time but for now it works well enough and writing custom controls that feel like standard controls is relatively easy. If you handle the drawing correctly it is also one of the fastest and snappiest systems around.

I had the exact same issues with WinUI3, where each time I compiled and wanted to run the application I had to install it into Windows, with its own start menu entry and registry entries and all that stuff. Really inconvenient and not worth it unless you like and desire that "new app" look of the Settings etc.

Qt wasn't too bad but you still had to do a similar install step within CMake to make the necessary Qt DLLs available to your application to run it. It's also not the fastest system around for UI.

By @avsteele - 5 months
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)

By @account42 - 5 months
> Writing the GUI part of the program should not take more time than the actual functionality

That's rarely a reasonable expectation. Good usability is hard work.

> I figured out that for simple apps there is simply nothing better suited than Dear ImGui.

If you hate your users, sure. For anything more than a toy please use a real GUI framework.

By @anothername12 - 5 months
Also check out IUP. It’s lovely to work with and uses native controls. https://www.tecgraf.puc-rio.br/iup/
By @torginus - 5 months
Ooh I remember having a 'Windows API fundamentals' elective at college. I wrote an app with a couple buttons, menu and scrollable text area, but not much in terms of functionality, in pure C, that was all around well-behaved. It was more than a thousand lines.
By @dkersten - 5 months
Dear ImGui is nice but beyond basic styling, it’s not exactly quick and easy to style. It also lacks any kind of accessibility features, which is fine when you’re making tools for games or similar (ie highly visual tools), but if you’re making anything meant for a wider audience, you really should use something with solid accessibility support so stuff like screen readers work.
By @userbinator - 5 months
Problem: It is extremely hard to stylize native Win32 controls.

That's not a problem, it's a feature. I am absolutely bloody sick of apps that go out of their way to reinvent the standard UI controls in perplexing ways and behave unexpectedly. Following the system UI preferences is what you should do, and it irritates your users if you don't.

There is a “hidden” dark mode for Win32 controls used by Windows File Explorer that you can activate, but it covers only some of the controls and still doesn’t look good.

Don't do that. If you use the regular Win32 controls then they will automatically get the styling the user has set.

I've been writing Win32 apps for close to 30 years now. It's sad to see the regression in UIs over the years.

By @squarefoot - 5 months
"Writing GUI apps for Windows is painful"

Until you discover Delphi/Lazarus.

By @ceeam - 5 months
Who's going to tell him about C++ Builder (Embarcadero)?
By @hgs3 - 5 months
> It would require me to write a custom paint function for every single control, which would take so much time I could raise a family in the meantime.

Implementing a custom paint routine is how you do theming in many UI toolkits. I get the impression the author is looking for a toolkit with declarative theming, like CSS.

By @dgellow - 5 months
WPF is still a perfectly viable solution

> The issue is that with bundling the .dll, it would still mean it being extracted somewhere and writing additional code for the P/Invoke to work, and C++/CLI gets compiled to .NET IL code, in other words, you can open the resulting app in dnSpy and see the C++ code translated to C# equivalent (which is not what I want, I want native code).

I don’t understand how that makes WPF a non-viable solution. The author seems to have pretty strong feeling that it should absolutely be native code, but it’s not clear why

By @canistel - 5 months
Native widgets which used to be wxWidgets' strong point, is now its Achilles heel? It is saddening, but the world moves on I guess.

Sadly the same applies to Lazarus/LCL too. Not only that, I had a nasty surprise recently when Fedora Budgie did not install GTK2 by default.

Win32 era was fun, for development and for reversing. But alas...

By @wolpoli - 5 months
> The result should be a single .exe file with no or minimal dependencies and a size of less than 40MB

Computers come with a modern browser now. Instead of a .exe file, could it be, let's say, a single .html file with inlined image/css/javascript?

By @jerf - 5 months
When people ask "why isn't there an awesome native widget set for my favorite language?" I have often said that GUIs are way, way, way harder than you think. It's easy to create a toolkit for your exact use case, but to create a toolkit that fits everyone's use cases to some degree is vastly, vastly larger than merely creating a programming language and a reasonable standard library. Vastly.

This is a great example of why. A small set of reasonable requirements and already almost all the options on what is probably the best-endowed OS for toolkits are almost all disqualified, and what did fit was an odd solution that won't work for a lot of other use cases. It isn't that these are unreasonable requests per se, it is that this is how this space works. Everybody has weird requirements of some sort, pretty much all the time, and getting even reasonable coverage is a huge, huge project.

By @pugworthy - 5 months
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.

By @fleabitdev - 5 months
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 flexible enough to keep up with changing fashions in UI development. Whenever somebody comes up with a new UI paradigm, you're not going to be able to take full advantage of it until somebody designs a new programming language with that paradigm in mind.

If so, this might explain why the Windows team keeps pushing new desktop UI libraries, only to abandon them within a few years - they just don't have the willingness or resources to migrate away from C# and C++, and so the quality of their UI libraries is stuck in 2006.

By @bonestamp2 - 5 months
I work on several enterprise apps that are .NET but the GUI is a webcontainer with a web app. Unless there is something particularly high performance happening in the GUI, this works really well for several reasons:

1. We can update the gui without the user installing an update.

2. Lots of great web ui libraries, designers, and developers to make it look great.

3. Relatively lightweight

By @jacinabox - 5 months
Actually a lot of people are saying that Linux is the best platform for developing GUIs.
By @magicalhippo - 5 months
Writing GUI apps for Windows in C++ is painful

There, fixed it for ya.

There are solutions if you're not hell-bent on using C++, be it .Net, Lazarus (FreePascal) or Delphi. We're using Delphi at work and for the most part it's super simple and easy.

By @graynk - 5 months
Writing GUI apps for anything is painful, if we’re being honest. To this day I haven‘t seen a single good GUI framework for any of the platforms that I‘ve tried. Flutter feels nice though
By @gavinhoward - 5 months
I have ideas about writing a GUI framework [1], but why in the world would I spend the time to make it up to the author's standards unless someone was paying me?

GUIs are a lot of work. People should be more willing to pay for work like that. Wanting everything free is one reason Big Tech has so much control.

[1]: https://gavinhoward.com/2024/05/a-new-architecture-for-a-gui...

By @jll29 - 5 months
The amount of bloat everywhere today is simply disgusting; just because my group server has 1 TB of RAM isn't a justification for letting a "hello world" app grow to more than 50 kB, GUI or not.

Yes, productivity is more important than squeezing out the last bit nowadays, but that the poster couldn't get his 40 MB limit satisfied shames the whole software industry. He should get a simple (i.e., half a dozen menus, dialogs, windows) GUI app done in 400 kB (it was possible in the past).

By @bambax - 5 months
LuaRT (https://luart.org/) came up here a couple of months ago; would it meet the requirements?
By @lowleveldesign - 5 months
Apps developed for the modern (open-source) version of .NET may be compiled to a native code (NativeAOT). Some time ago, I tried AOT on a simple WinForms project and it worked. Unfortunately, functions using COM APIs are not yet supported (as they rely on reflection). There is an ongoing effort to fix this problem: https://github.com/dotnet/winforms/issues/4649
By @cjk2 - 5 months
The painful bit is C++. I did a fair bit of that going back to MFC. Knocking stuff out in C# with WPF and WinForms was quite nice in comparison. I haven’t found anything nicer.
By @boffinAudio - 5 months
I just write GUI's in tkinter (python), build a single .exe with nuitka, and interface with generalized application functionality either as a .dll or python module ..

tkinter may not be the sexiest way to do things, but its definitely productive in terms of the code-compile-distribute methodology, and it is very easy to wire up to a generalized 'daemon'-style abstraction, where the app logic is implemented as a daemon, sent application commands over a well-greased socket.

With this architecture, I no longer care that its Windows underneath - this is just another platform target - and can easily use either MacOS or Linux as the development environment, needing only to test on Windows, ultimately.

Anything beyond the sphere offered by tkinter is just less appealing. If I have to start treating a platform target in any kind of 'special' way, I just lose interest in that target, as a whole - however, from a UI perspective, Windows tkinter support hasn't been that bad, and generally keeps up fine.

(Disclaimer: if I really need performance, I also use the JUCE framework for my needs - even though its an audio-centric framework, you can build GUI apps with it just as well, and its also a cross-platform way to do things in pure C++ ..)

By @cryptica - 5 months
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.

By @xbar - 5 months
For someone who demands so much of other people's open source, the author is quite unwilling to open source their solution.
By @symisc_devel - 5 months
Open source GUI libraries are lacking behind the gate locked, closed ones like Adobe. Even Macromedia UI back in the days 20 years ago looks way more appealing and polished than the current open source offering. The only polished open source UI in my opinion is Blender but apparently they have their own rendering engine built from scratch just like Adobe.
By @theanonymousone - 5 months
Writing GUI apps is painful, and being probably the most thankless area in Software engineering doesn't help either.
By @garaetjjte - 5 months
>The issue is that with bundling the .dll, it would still mean it being extracted somewhere

Hmm, this got me thinking about stuffing native code into CLR image. If you would just include additional executable code sections into PE, would loader map them normally? Or presence of IMAGE_DIRECTORY_ENTRY_COMHEADER would stop it from mapping native code? If so, maybe you could remove that header and manually do pre-XP style initialization, by calling _CorExeMain from imported mscoree.dll. Though you would need to somehow trick it into locating COMHEADER that we removed.

Or maybe I'm overthinking this and MS already supports that? https://learn.microsoft.com/en-us/cpp/dotnet/mixed-native-an...

By @ysc3839 - 5 months
Take a look at Win32 + Xaml Island. You will find that most problems in WinUI 3 gone.

Because Xaml Island is a "system component", you don't need to install or bundle anything. And unpackaged .exe is supported.

There's one problem, if you want to use Xaml Designer in Visual Studio: Because .xaml files are compiled and packaged into a "resources.pri" file. You have to ship this file with your .exe program. This can be solved by hooking system dll, see my project: https://github.com/ysc3839/SingleExeXamlIsland

By @openrisk - 5 months
One would think that after three decades of the windows metaphor and billions of man-hours writing such applications, writing GUI apps (for any platform) would be a much more pleasant experience?

One could imagine a framework that would absorb all this historical know-how and turn GUI app development into a zero marginal cost exercise (fast, functional, cheap and maybe even pleasant) but who would push for this and why?

Maybe its a case of somebody not learning a lesson when their economic interest depends on not learning it?The overview of existing frameworks (including browser/webview based) suggests there is a sort of stagnating stalemate that feels sub-par but probably works just fine for those who have any leverage over the status-quo.

By @wedesoft - 5 months
You can just use Qt's DLLs and use NSIS to make a Windows installer. I have developed the Anymeal recipe database software like that and the resulting installer is 20 MByte https://wedesoft.github.io/anymeal/ Also Qt is cross-platform (Windows, GNU/Linux, MacOS).
By @demondemidi - 5 months
As someone who spent most of the early 1990's writing Win32 apps, it doesn't seem like much has changed! MFC has always been a pain to use, especially coming from X and Motif.. even Athena widgets were better than MFC.

I've used QT in the past decade for MWL (Mac/Win/Lin) and it is a bit clunky compared to the graphical fluidity of Electron. We just need a solid effort to make Electron smaller. Granted, one can build smaller variants, but even 100 MB is far too large.

By @thefz - 5 months
Nope, not at all. Winforms is still actively maintained and sports native advanced features like MVVM and async support. And winforms is not even the only option.

I disagree with the entire aeticle.

By @skrrtww - 5 months
What are the issues the author alludes to about AppX packages sucking? Looks like the new Fluent stuff wants you to use those. Curious to know what pain points exist there.
By @gchokov - 5 months
It was a breeze, back in the RAD / Delphi days..
By @bigmattystyles - 5 months
I'm a fan of a self hosted web service bound only to localhost, then you serve a HTML with all the bells and whistles from that web service. I think they used to call it OWIN. I guess the major downside is that you might get a localhost cert warning if you don't install a self-signed cert and a root cert in the PC's cert store (which yes, yikes)
By @jcaguilar - 5 months
This reminded me of The Cherno’s Walnut library:

https://youtu.be/-NJDxf4XwlQ

By @boxed - 5 months
This was a big reason I switched to the mac many years ago. I was a win32 programmer professionally, but I was more productive on mac after a week or so of hobby fiddling around.

There is simply no contest. MacOS 10.0 was far superior as an environment to develop desktop apps when released, than Microsoft Windows is today with any toolkit you might want to choose.

By @ramesh31 - 5 months
> Writing the GUI part of the program should not take more time than the actual functionality

I can't stand this mentality. The GUI is your functionality. The rest as far as the user is concerned may as well be pixies and fairy dust. Treating UI as an afterthought is why we've ended up with so much nightmarish crap these days.

By @philipwhiuk - 5 months
There's a reason a lot of stuff is Electron.
By @neonsunset - 5 months
The author would have been served extremely well by AvaloniaUI with NativeAOT target if they were willing to drop their assumptions regarding C# that are no longer true. (I wonder how well Uno Platform fares in comparison? It targets native controls first and foremost but is supposedly NativeAOT compatible too)
By @rovingeye - 5 months
Win32 + WebView2
By @grahar64 - 5 months
Not an expert, but could you use something like https://enigmaprotector.com/en/aboutvb.html to virtualize a file system to create a portable exe. Not sure if the size would exceed your specs.
By @pregnenolone - 5 months
I've had a good experience with JavaFX and I even managed to AOT compile two faily complex applications of mine. My advice would just be to stay away from FXML. Also use jlink to build a stripped down JRE for your application and package it with jpackage.
By @speedypete - 5 months
Pay for a professional tool and get RAD Studio (C++Builder/Delphi combo) from Embarcadero. https://www.embarcadero.com/products/rad-studio
By @mrcsharp - 5 months
I don't see Avalonia[1] mentioned here. Maybe that would work? It has AOT support too so should help with distribution and file size.

[1] https://www.avaloniaui.net/

By @djbusby - 5 months
I don't see any mention of WinAmp yet. That app really whipped the llamas ass when it came to styling. And was super easy to create custom skins.

I'm all-on-board with look like the OS/platform but also, here's and example of custom styling done well.

By @robertlagrant - 5 months
Tauri[0] is another HTML/CSS/JS-converter that generates small binaries by relying on the presence of WebView. Works pretty well.

[0] https://tauri.app

By @mjevans - 5 months
Windows (MS) and OSX (Apple) need to agree on a GUI interoperability API. Either hammer something out, or adopt one/more of the OSS GUI framework specifications from QT and GTK.

It MUST be open spec. It MUST be free for all/any to implement. It MUST either be included or be in the primary vendor (MS, Apple, distro) software center.

A simple Hello World, click OK to exit the program application should be able to be cross-compiled for any platform, and the resulting binary MUST NOT require including / embedding DLL / library hell like everything today does. It SHOULD be a small entirely dynamic program; possibly a few hundred kilobytes at most but even that seems too large. After all, it would mostly be the basic boilerplate of setting up memory, calling the system library loader, and linking in the shared libraries.

By @donatj - 5 months
> Writing the GUI part of the program should not take more time than the actual functionality

Oh man, I wish. No such tool exists. Adding a GUI to anything almost always at minimum triples the complexity.

By @hermitcrab - 5 months
>Alternatively, you can buy a commercial [Qt] license for several thousand dollars.

There is a small business option that is cheaper. But probably still not appropriate for this project.

By @HumblyTossed - 5 months
On the rare occasion I find myself needing to write a windows gui, I just use winforms. I don't have to muck about with XML nonsense and it just works.
By @banish-m4 - 5 months
A. If a gun were placed to your head and you had to write a native Windows app, what stack would you use?

B. And, if you had to write a cross platform app, which framework would you use?

By @Log_out_ - 5 months
Don't ,don't say that,every time you say that windows gains another guiframework that precents fixes to winforms,the only one they support..
By @firebot - 5 months
There's tools to pack dependencies into a single executable, that then extracts those dependencies, as necessary, upon execution.
By @dmitrygr - 5 months
“Stylized”

Let me stop you right there. No.

Leave the OS to style controls how it does, for consistency. There is no reason to be inconsistent. This is not 1994 and you’re not writing a warez keygen

By @warvair - 5 months
Just use Godot (https://godotengine.org).
By @renegat0x0 - 5 months
The requirements are strict.

For myself I rarely write app. Most often I self-host programs. GUI is managed by a browser.

By @anthk - 5 months
Lazarus and Free Pascal might work here.
By @wiseowise - 5 months
Did someone suggest Flutter yet?
By @synergy20 - 5 months
write a cross platform GUI is even more painful.

It's pretty much either paying for Qt or use the bloated Electron.js. Looks like the latter won the market.

I failed to see other practical options, flutter was an option, but its strength is not on desktop so far.

By @shrimp_emoji - 5 months
Writing anything for Windows is painful. Writing it on Windows is even painfuler.
By @the__alchemist - 5 months
I've been using EGUI to write GUI programs. Works nicely and runs on both Linux and Windows without notable differences. (I haven't tried Mac, but it presumably will work there as well without changes). Small binaries (a few Mb), and can integrate with maps, 3D rendering etc.
By @ChicagoDave - 5 months
Wouldn’t Electron solve this problem?

Build a web app and use Google V8 with your c++ code.

By @airstrike - 5 months
Shoutout to the Rust library `iced` which is cross-platform, amazing, and can do anything you need it to at blazing fast speed and low memory footprint: https://github.com/iced-rs/iced
By @JodieBenitez - 5 months
I don't do a lot of desktop apps but for simple GUI apps I've been using Python and Pywebview, with packaging left to Pyinstaller. The main reason is that I get to reuse the python/javascript/css libs that I know, and it's easily portable. I'm sure a native app uses less memory and cpu but frankly what I get with this combination is not that resource hungry. In fact, anytime something goes south it's my fault for using poor algos. Also, there are tons of great GUI libs and web components.
By @masfoobar - 5 months
While I have dabbled in a number of GUI libraries - many of them were a few years ago so covering my views on those would be disingenuous. I remember using Win32 or MFC.. and dabbled in Qt, etc.

In recent years, I have used WPF/Avalonia and while they are good - can lead to a lot of bloat following MVVM.

In the last year, I remember needing an application that shows a map. I tried to find support for openstreetmap and, while they exist, did not support what I needed to do. I tried Avalonia, and then GTK, etc. To be honest, I really liked GTK.. it just didn't have the tools I needed, sadly.

I have leaned to immediate mode UIs these days. I like I can create something with minimal code. Sadly, no openstreetmap support from what I can see.

In the end, I created a web interface. openstreetmap (leaflet) did everything I needed.

By @mmargerum - 5 months
Delphi is the superlative windows desktop development tool. It does support styling and just about anything else you would want. There is a free alternative in Lazarus but I don’t know if it supports styling
By @p0w3n3d - 5 months
I've been a strong lover of Qt, but I've just undestood that one cannot statically link it. Tbh it's never been the case in my situation, usually writing in PySide bindings which will never link dll/so libraries, however in certain situations this would get really expensive, if static linking would be required.

   I am writing this article while it’s 32°C inside my room.
It took a horrendous heat to make a programmer find the best GUI library, but it was worth it! 500KB for imgui? Seriously? I remember Inno Setup creator saying that we was compiling his 'boot' application (to reduce size, because it was glued as a prefix to a zip file) in Delphi 2...
By @kosolam - 5 months
How about gtk?
By @slackr - 5 months
Tried Decker?
By @IshKebab - 5 months
Frankly Qt is the only sane option. Just give up on the "single static exe" requirement. Your users will have to unzip a zip. Hardly a big deal. Certainly not worth switching your entire stack to something vastly inferior for.
By @popcalc - 5 months
>As a fellow European, I do not have air conditioning.

Is anything stopping the author from buying a heat pump?

By @Dwedit - 5 months
WX Widgets still exists.
By @mattgreenrocks - 5 months
Unfortunately, if you are insisting on a single exe file, then you have to be way more flexible on your requirements than the author is. There’s a reason that practically every Windows program has an installer. It’s stupid and a waste of time but also probably more of a waste of time to try to be the exception to this rule.

Frankly I don’t see why C# targeting an old (3.5?) .NET framework version wouldn’t work for the author. There seems to be a tendency to fixate on how things should be vs where we are now. C++ native GUI dev is not a mainstay like it used to be.

By @fuzztester - 5 months
Did they try JUCE?
By @okasaki - 5 months
> Problem: When linking dynamically, there are a myriad of different .dlls required to run the app, totaling over 40MB.

Is 40MB a lot nowadays? Eg the argocd cli is 155MB, and that's just a relatively simple cli app that as far as I know just calls a remote api.

Welcome to bloatworld I guess.

By @johnea - 5 months
Qt is the hero
By @smittywerben - 5 months
Microsoft: Here are cool windows for Windows.

Microsoft: Oh, yeah, to use it, you'll need to deploy it with the Microsoft Store.

By @dusted - 5 months
"Problem: It is extremely hard to stylize native Win32 controls." No. Don't style them. Let the users settings dictate how your app looks. This is the correct way.
By @cerrorism - 5 months
I would like to show my appreciation to the author of this blog, although a lot of comments here show otherwise, as the restrictions the author has involved here are considered as "unrealistic" or "unreasonable".

Whenever an article is trying to compare several options, it is very important to know beforehand what the author is trying to achieve, and what the restrictions are. And in this blog, the author has clearly stated that the restrictions are to develop a GUI within 40MB and should be easy styling. No one should judge the author for the restrictions, as it may be from the author's specific needs, or directly come from the client's requirements. The clear restrictions are also very helpful for readers like me to understand the trade-offs the author has made, which is not something that I have to do myself, but I can definitely learn from the author's experience. If I am in a similar situation, or even with different restrictions and need to make a different trade-off, the author's experience can still be very helpful for me.

Just want to call out that it is not a fair ask for a blog post to exhaustively compare all the options, as it is very time-consuming for even a paying job. We learnt the specific restrictions that the author is facing to, and we learnt the author's experience with the options that the author has tried. That is already a lot of value that the author has provided to us, and I would like to thank the author for that.

By @syngrog66 - 5 months
ah, the intersection of 2 anti-patterns: GUIs and MS Windows. lol
By @pan69 - 5 months
The solution you end up with will be a compromise on your requirements. E.g. if you can compromise on the 40MB size requirement then Electron should be a good fit to cover all your other requirements.

Microsoft has developed VSCode with Electron.

https://www.electronjs.org/

By @FactKnower69 - 5 months
>WinUI

>modern Windows components

I swear to God if I ever downloaded a piece of open source software from GitHub, opened it, and saw the deformed Windows 8 Metro UI gawping back at me, I would do everything in my power to wipe the blighted individual responsible from the face of the fucking Earth