As with my other recent post (Learning Materials for getting into C programming for MS-DOS/PC-DOS/DR-DOS/FreeDOS), I’m also gearing up to do the Windows 3.1 hobby programming I wanted to do as a kid but couldn’t, and that means collecting learning resources for that too.
NOTE: I haven’t managed to research the intermediate and advanced materials as thoroughly as for DOS yet, so suggestions are welcome.
- C Programming itself
- As with DOS programming, I don’t want to recommend the books I just happened to use. Any book should do.
- Segmented memory models in C, linked lists, hash tables, and the trade-offs therein
- Win16 adds more to memory management on top of what’s available in DOS, but it’s fundamentally still just real-mode C or C++ programming, so start by learning the same things.
- Borrow Microsoft C: Secrets, Shortcuts, and Solutions by Kris Jamsa from the Internet Archive’s book library and read chapters 25 (Dynamic Memory Allocation) and 28 (Understanding Memory Models) and borrow Advanced Turbo C by Herbert Schildt and read Chapter 3 (Dynamic Allocation) and Appendix A (Turbo C Memory Models). (I didn’t find either to communicate the relevant ideas ideally, but seeing the same thing explained by two different people really helps.)
Alternatively, Schildt’s Advanced C, Second Edition from the following year appears to have all the same content in the relevant sections as Advanced Turbo C does. (The first edition spends less time on those topics and I didn’t see a section on memory models in it, so I advise only consulting it if you want a dead-tree edition and can’t find any of the other suggestions from Schildt cheaply.)
- See also the Special Pointer Types for Open Watcom C/16 section of the Open Watcom 2.0 C Language Reference once you’ve had things start to click.
- If you want to buy just one book, buy one of the books by Schildt. Jamsa’s phrasing on memory models was a bit more illuminating for me, but Schildt’s no slouch there and he goes into much more detail on data structures, including implementing and comparing the strengths and weaknesses of three different ways to implement sparse arrays.
- Windows 3.1 Application Quick Start
- Read Building Win16 GUI Applications in C by Transmission Zero. It’s a quick online article/post that goes through how to produce the working skeleton of a Windows 3.1 application using a 16-bit Microsoft C Compiler but explicitly points out Open Watcom C/C++ as one of example of the any other compilers with the “necessary headers and libraries for Win16 development” that should work too.
- Beginner Windows 3.1 Programming
- Programming Windows 3.1 by Charles Petzold is apparently considered the gold standard for an introduction to Windows 3.1 programming. Thankfully, it’s available in the Internet Archive’s lending library and, thankfully, Mr. Petzold still offers a download of the companion floppy on the old version of his website.
- In the event that you can’t use that for some reason, another one which the Watcom manuals suggest, which isn’t in the Internet Archive’s collection is Windows Programming Primer Plus by Jim Conger from Waite Group Press. It’s not in the Internet Archive’s collection as far as I can tell, so you’d have to turn to WorldCat or AbeBooks for that one.
- Windows 3.1 API Reference
- If you’re using Open Watcom C/C++, then you won’t have the advantage of Microsoft’s Windows API documentation.
- Their manuals recommend buying the Windows API Bible (Windows 3.0 APIs) and the Windows API New Testament (Windows 3.1 API additions) by James L. Conger from Waite Group Press… both of which are also in the Internet Archive’s lending library.
- Intermediate Skills
- This is where things get hazy. Historically, people tended to learn about this sort of thing through journals like Dr. Dobb’s Journal, The Windows Programmer’s Journal, and so on. There are also some journal issues included on the MSDN Library Archive CD that you could get as an option from Microsoft back in the Windows 9x era and install using the CD key from the corresponding release of the regular MSDN library disc. However, those don’t turn up very often on eBay.
- That said, for a less involved way to start moving beyond beginner materials, my searches turned up a book named The Windows Programming Puzzle Book by Kim Crouse… and, yes, that is another link to the Internet Archive’s lending library. To put it simply, the first third of it is a set of questions, programming challenges, and buggy programs to be fixed, and the latter two thirds are answers, including explanations for why they’re the answer.
- As for DDE references, I ran across a piece of advice in Dino Esposito’s Visual C++ Windows Shell Programming which recommends the documentation included with the Microsoft Internet Client SDKs as the best place for information on DDE… which I believe are the files archived here.
- Advanced Stuff
- Funny enough, the advanced stuff was easier for me to find, because there are good resources in the same series as Undocumented DOS and The Undocumented PC, which I already had. Specifically, Undocumented Windows by Andrew Schulman, David Maxey, and Matt Pietrek and Windows Internals by Matt Pietrek, both available in the Internet Archive’s lending library.
A Note on Convenience Over Openness
If you find writing a Windows 3.1 application in C or C++ too daunting and your primary goal is solving your own problems conveniently with no concern for making available open-source code for anyone to contribute to, there are options which are generally much easier than C or C++, but require buying proprietary software.
Suggestion 1: Borland Delphi 1.x
My first recommendation would be to search eBay for a copy of Borland Delphi 1.x on CD (either on its own or included on the CDs for Delphi 2.x through 4.x to support 16-bit development.).
It produces fast, self-contained EXEs and, for the kinds of tasks taught by Petzold in Programming Windows 3.1, it’s stupid simple.
(Having never used it before, I was able to create a “mirror a text field’s contents in a label” application in five minutes, just by dragging a couple of controls into the dialog builder that it opens into, double-clicking the text field to open up the
Edit1Change handler, tentatively typing
Label1.Text = Edit1.Value into it, pressing F9 (Run) to get an error message telling me my guess was wrong, and then selecting identifiers and pressing F1 or choosing “Topic Search” from the context menu to discover that it should be
Label1.Caption := Edit1.Text.)
Seriously. Delphi is a ridiculously polished way to quickly whip up a GUI application, even for 2023, let alone for 1993.
Suggestion 2: Visual Basic 4 or lower
My second choice would be Microsoft Visual Basic 1, 2, 3, or 4.
It’ll be harder to find copies on eBay, they’ll probably cost more, the resulting binaries won’t run as fast, it doesn’t produce self-contained single-file executables, the IDE-Help integration can’t automatically resolve an identifier’s name to the corresponding widget’s documentation, CD-ROM versions of anything older than Visual Basic 4 are practically unobtanium, and Visual Basic 4 splits binaries across many more files than Visual Basic 3… but its ease of use is comparable to Delphi and I was still able to make the same test app in under 5 minutes when I haven’t touched BASIC of any kind in over 20 years.
Visual Basic 3 is generally agreed to be the best version for Windows 3.1 development.
Suggestion 3: WinBatch
If so, go to the WinBatch website and buy a copy. They explicitly say “Support for Windows XP, Vista, 7, 8, 8.1, 10, 11, 2003, 2008, 2012, 2016, 2019, and 2022. Older versions are available for 95, 98, ME, NT, 2000, and even Windows 3.1”.