What happened to the return code from WinMain in 16-bit Windows?


Commenter S asks, "What happened to the return code from WinMain in a Windows 3.1 app?" After all, there was no GetExitCodeProcess function in 16-bit Windows.

Basically, the exit code vanished into the ether.

Unless you captured it.

The Toolhelp library provided a low-level hook into various parts of the kernel, allowing you to monitor, among other things, the creation and destruction of tasks. That was how you captured the return code of a Windows program in 16-bit Windows.

But if you didn't catch it as it happened, it was gone forever, lost in the ether.

Comments (7)
  1. NB says:

    Wow, that's sad :(

  2. David Matthew says:

    Like sand through the hourglass, so goes the return codes of our lives.

  3. Brian says:

    Poor little guy.

  4. Cheong says:

    I thought applications at that time was used to check AX register directly for return values. :P

  5. nobugz says:

    That took me seven years to figure out.  Wow, did I look for it back then.  Convinced it couldn't be read, I flipped the ignore bit on it for a *long* time, well past Win32.  Programmers' lives were tough before the age of blogs, uphill both ways.

  6. Neil says:

    The Windows 3.1 SDK has sample code to demonstrate how WinMain should return the value passed to PostQuitMessage.

  7. Morten says:

    So *that* is why the bitbucket overflowed occasionally – it couldn't handle all those bits at once. I knew there was a reason.

Comments are closed.

Skip to main content