Microsoft KB Archive/60388

INF: Creating Windows 3.0 Apps That Are Compatible with 2.x ID Number: Q60388

2.03 2.10 3.00 WINDOWS

Summary:

Applications that are targeted at both Windows versions 2.x and Windows 3.0 must be developed using the Windows 2.x Software Development Kit (SDK). To take full advantage of the Windows 3.0 environment, target your application solely at Windows 3.0 and use the Windows 3.0 SDK to develop it.

In other words, DO NOT try to build 2.x applications with 3.0 tools.

More Information:

The following are the options for running under Windows 3.0:


 * 1) Compile applications using the versions 2.x SDK, then mark them as compatible with Windows 3.0. Such applications can run under both Windows 2.x and Windows 3.0. However, applications compiled using versions 2.x SDKs cannot use the new Windows 3.0 APIs.
 * 2) Compile the application using the version 3.0 SDK. Such applications can run only under Windows 3.0; however, they can take full advantage of the new features that Windows 3.0 offers.

Microsoft does not provide any tools or support for achieving the effect of having a Windows 3.0 application that runs in Windows 2.x. However, the converse is supported (that is, building a Windows 2.x application, testing it under 3.0 to make sure the proportional fonts and protected-mode memory scheme do not cause problems, then marking it as Windows 3.0 compatible with the MARK.EXE utility.) This process (making the 2.x application 3.0-aware) is described in the “Microsoft Windows Software Development Kit Installation and Update Guide” for version 3.0.

The Windows 3.0 SDK libraries, include files, and resource compiler do not attempt to support the Windows 2.x environment. For one thing, running into errors with bad ordinal references may occur because Windows 3.0 has new functions with new ordinal numbers, and Windows 2.x will treat them incorrectly when it encounters them (FatalExit 0x0403 “Invalid Ordinal Reference to USER” errors occur in debug mode).

In some cases, it may be necessary to check the version and then take appropriate action. For example, if the columns in the list boxes are misaligned in version 3.0 but correctly aligned in 2.x, it is possible that spaces were used to align them. Spaces do not perfectly match characters in a proportional font. To avoid this problem, use the GetVersion call to see which version of Windows the application is running in (Windows 2.x or Windows 3.0). In 2.x, use spaces; in 3.0, align the text with the WM_SETTABSTOP message.

If it is necessary to call a particular Windows version 3.0 function that does not exist in Windows versions 2.x, use the GetProcAddress function to get a far pointer to the function; this method eliminates the need for the function’s import reference to exist in the xLIBW library the program is linked to.