Example of Migrating Code
The following is example of the steps you might follow to convert and compile
code that uses the sample code-hiworld.c:
Sample
- Convert the Windows 32-bit resource file hiworld.rc
to an OS/2 resource file using SMART.
Note: SMART will rename the Windows 32-bit resource file from hiworld.rc
to hiworld.rcx and creates an OS/2 resource file named hiworld.rc if you
click on the Overwrite Original radio button on the Resource Translation
dialog. Otherwise, SMART names the OS/2 resource file hiworld.rcx.
- Change hiworld.h to include hiworld.hhh, which
is the output from SMART. hiworld.hhh contains #defines for the resource
IDs. For your convenience, this change has been flagged with comments in
the Windows 32-bit hiworld.c source code. The comments are removed in the
OS/2 hiworld.c code.
- In any source module that includes <windows.h>,
change:
#include <windows.h>
to:
#include <os2win.h>
This change has been flagged with comments in the Windows 32-bit hiworld.c
code. The comments are removed in the OS/2 hiworld.c code.
- Change the code in hiworld.c that uses string
resource IDs to use MAKEINTRESOURCE with the numeric resource IDs in hiworld.hhh.
These have been flagged with comments in the Windows 32-bit hiworld.c source
code. The comments are removed in the OS/2 hiworld.c code.
Note: This is a temporary restriction.
- Create a DEF file and specify a stack size of
at least 128KB. Include a NAME statement which specifies an apptype of WINDOWAPI.
- Link main.obj (found in the toolkit\c directory
under your Open32 directory) with hiworld.obj to form hiworld.exe. This
is done in the makefile provided with this sample.
- Run hiworld.exe as you would any other OS/2
executable file.
[Back: Testing]
[Next: Open32 Functions]