A Simple PM Window sample application for OS/2 Presentation Manager.
This is a minimal OS/2 Presentation Manager (PM) application written in C. It demonstrates fundamental PM programming concepts by creating a standard frame window with a custom client area that accepts and displays keyboard input with automatic word-wrapping.
The program registers a custom window class (MyWindow) that allocates per-instance storage for a text buffer. Characters typed by the user are appended to the buffer and drawn in the client area using WinDrawText with word-break support. Pressing F3 exits the application.
- Standard PM frame window with title bar, system menu, min/max buttons, and sizing border
- Custom window class registration with per-instance data storage
- Keyboard input handling — characters are accumulated and displayed
- Word-wrapped text rendering in the client area using GPI
- Window text protocol support (
WM_SETWINDOWPARAMS/WM_QUERYWINDOWPARAMS) - F3 key shortcut to exit
- OS/2 Warp 4.5x or later (including ArcaOS)
- GCC 9.2 (bitwiseworks / kLIBC) or OpenWatcom 2.0 C compiler
Install build tools on ArcaOS:
yum install git gcc make libc-devel binutils watcom-wrc watcom-wlink-hll watcom-wipfc
├── src/ Source files
│ ├── simple.c Main source file
│ ├── simple.h Header file
│ ├── simple.def Module definition file (BLDLEVEL)
│ ├── simple.ico Application icon
│ └── simple-ow.lnk OpenWatcom linker directives
├── bin-gcc/ GCC build output (created by build)
├── bin-ow/ OpenWatcom build output (created by build)
├── wiki/ Screenshots
│ └── Simple_001.png Application screenshot
├── compile-gcc.cmd GCC build script
├── compile-ow.cmd OpenWatcom build script
├── makefile-gcc GCC makefile
├── makefile-ow OpenWatcom makefile
├── .gitignore Git ignore rules
├── LICENSE BSD 3-Clause License
└── README.md This file
# Using the compile script
compile-gcc.cmd
# Using make directly
make -f makefile-gccOutput: bin-gcc\simple.exe
# Using the compile script
compile-ow.cmd
# Using wmake directly
wmake -f makefile-owOutput: bin-ow\simple.exe
make -f makefile-gcc clean
wmake -f makefile-ow cleanThe executable includes BLDLEVEL information that can be queried using the OS/2 bldlevel command:
bldlevel simple.exe
This version of this sample was modified to compile on ArcaOS with GCC 9 compiler.
-
Make sure you have the correct header files in your path. For GCC the correct ones are included in
libc-devel, not the ones from the OS/2 Toolkit. Check yourconfig.sysforSET INCLUDE=C:\usr\include. -
Since the Watcom Resource Compiler (open source) and Watcom Linker are used instead of the classic
rc.exeandilink.exe, add to yourconfig.sys:SET EMXOMFLD_LINKER=wl.exe SET EMXOMFLD_TYPE=WLINK SET EMXOMFLD_RC_TYPE=WRC SET EMXOMFLD_RC=wrc.exe -
Run
compile-gcc.cmdormake -f makefile-gccto build. The compile script sets these environment variables automatically.
-
1.03 - 2026-07-24
- Reorganised directory structure (source files in
src/, build outputs inbin-gcc/andbin-ow/) - Added OpenWatcom build support (makefile-ow, compile-ow.cmd, simple-ow.lnk)
- Improved source code documentation
- Improved README documentation
- Added .gitignore
- Reorganised directory structure (source files in
-
1.01 - 2023-07-16
- Changed version to compile on GCC and to run on ArcaOS 5.0.7
-
1.0
- Original version
BSD 3-Clause License — see LICENSE file for details.
- Martin Iturbide / OS2World (2023)
- Original Author
