6 ms·
Too bad win32 is such a finicky and verbose API that's painful to use for anything beyond the simplest of dialogs. I tried. The MSDN documentation doesn't quite
by pdenton 5y ago
Too bad win32 is such a finicky and verbose API that's painful to use for anything beyond the simplest of dialogs. I tried. The MSDN documentation doesn't quite cut it. TheOldNewThing by Raymond Chen is a must-read to get it right.
But above all, a stable ABI is only needed for proprietary programs which I abhor for not being FLOSS. As a programmer, I really do think the 4 freedoms are important and loathe anything non-compliant.
- alkonaut 5y agoRunning Win32 UI code as WinForms through .net is a lot less painful than doing straight Win32. Not very good for deploying a tiny program obviously though.
- ripley12 5y agoThere's been a lot of work happening to make WinForms trimmable. I think it will land in the upcoming .NET release (7) or the next one, I'm looking forward to being able to ship small WinForms apps with zero dependencies. https://github.com/dotnet/winforms/issues/4649 https://github.com/dotnet/winforms/issues/4649
- pjmlp 5y agoOr MFC/ATL. Only masochits do pure C Win32, even back in the Win16 days we were better with OWL, MFC and VB.
- tonyedgecombe 5y agoWTL builds on ATL and is far nicer than MFC.
- pjmlp 5y agoIs WTL still mantained, though? That is why I did not mentioned it.
- tonyedgecombe 5y agoIt's quiet but doesn't seem dead. I've heard Microsoft use it extensively internally and it has come from a MS employee.
- pjmlp 5y agoWin32 is beautiful when compared against Xlib, Athena Widgets and Motif.
- pdenton 5y agoWhich have very sparse documentation, but do work just fine. Win32 covers a lot more than xlib, athena and motif. And still I have to resort to porting over bits and pieces from the FreeBSD C library because in a pure win32 project (no msvcrt), things are missing. The thing is, getting all the details right requires extensive research and a lot of extra nonsense that shouldn't be necessary. For compatibility, accessibility, consistency, etc. Sometimes it's amazing things work at all.
- pjmlp 5y agoWindows is not a UNIX clone, that is to be expected, and it isn't the only OS around that isn't from the UNIX school. Plenty of details documented across MSDN and Technet, and these old technology called books.
- pcwalton 5y agoI mean, that's debatable. But in any case Xlib, Xaw, and Motif can be completely bypassed nowadays--XCB and Wayland are complete replacements for Xlib (with EGL finally providing the needed XCB-compatible alternative to GLX), and GTK+/Qt are alternatives to Xaw and Motif--while Win32 is still the only way to do many things on Windows. Granted, the vast majority of devs use wrappers around Win32, so they don't have to care about the low-level plumbing.
- pjmlp 5y agoGtk+ and Qt are cross platform middleware.
- phendrenad2 5y agoNow I'm curious, what exactly were you making where the win32 documentation was insufficient, but the "one weird trick" blog TheOldNewThing was helpful? Did you buy any books on win32 or check stackoverflow? I've found win32 to be a bit hard to find documentation on sometimes (the official documentation is complete, but sometimes know which hook or function to use is up for debate, stackoverflow has good answers there), but overall it's a very good API that gets out of the way and lets me just build.
- pdenton 5y agoIt was an autorun program which would offer a list of what's on the CD along with some images whenever one of the items was selected. I've found a good reference here: https://github.com/mity/old-new-win32api https://github.com/mity/old-new-win32api The message loop (using MsgWaitForMultipleObjectsEx) was somewhere around 20 LOC, to enable all the things that the application had to do (including correct handling of dialogs). I don't count that as getting out of my way.
- GrumpyYoungMan 5y ago> "Too bad win32 is such a finicky and verbose API that's painful to use for anything beyond the simplest of dialogs. I tried. The MSDN documentation doesn't quite cut it. TheOldNewThing by Raymond Chen is a must-read to get it right." If it's helpful, I'd like to mention that Charles Petzold's "Programming Windows" has been pretty much the reference for writing Win32 apps since the '90s. (It's the same person that wrote "Code" and "The Annotated Turing".) You probably want the 5th edition as that's the last pure Win32 version; the 6th edition seems to be oriented towards C# based WinRT apps.
- ripley12 5y agoI got started with Win32 programming 2 years ago using the 5th edition of Programming Windows. It's great, but it did feel like it was missing a few things. For example, it doesn't cover disk I/O at all. I found that Pavel Yosifovich's "Windows 10 System Programming" was an excellent complement to Petzold; it fills in a lot of gaps, and it's quite recent which is nice (there were some bits in Programming Windows that would be dropped if it were rewritten today).