PM++ is a freeware C++ class library (v0.17) by Giovanni Iachello that wraps the OS/2 Presentation Manager API into a clean C++ hierarchy. Original version 0.16 (1994–1996); version 0.17 adds an Open Watcom 2.0 port, DLL build, and new samples.
| Header | Classes |
|---|---|
pmsys.h |
PMAnchorBlock, PMMessageQueue, PMApp, PMIniProfile, PMThread, PMWindowThread, PMEventSemaphore |
pmgpi.h |
PMPoint, PMRect, PMPointer, PMLogFont, PMDeviceContext, PMMemoryDC, PMPrinterDC, PMPresSpace, PMWindowPresSpace, PMMicroCachedPresSpace |
pmwin.h |
PMWin, PMMainWin, PMSubclassWin, PMMenu, PMSystemMenu, PMPopupMenu |
pmdlg.h |
PMDialog, PMModalDialog, PMModelessDialog, PMControl subclasses, PMFontDialog, PMFileDialog |
pmhelp.h |
PMHelpWin |
- Add
src\to your include path. - Link against
lib\PMPP.LIB. - Subclass
PMWin(orPMMainWin) and override the virtual handlers you need (paint(),command(),kbd(),mouse(),closed(), etc.). - Heap-allocate your window object —
PMWndProccallsdelete winautomatically whenWM_DESTROYfires.
Replace lib\PMPP.LIB with dll\PMPP_DLL.LIB in your link step. Copy
dll\PMPP.DLL to a directory on LIBPATH. No header changes are required.
class MyWin : public PMWin {
public:
MyWin(HAB hab) : PMWin("MyWin", hab) {
createArgs->pszTitle = "My Application";
}
BOOL closed() { WinPostMsg(hwnd, WM_QUIT, 0, 0); return TRUE; }
};
int main(void) {
HAB hab = WinInitialize(0);
HMQ hmq = WinCreateMsgQueue(hab, 0);
MyWin* win = new MyWin(hab);
win->createWin();
QMSG qmsg;
while (WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0))
WinDispatchMsg(hab, &qmsg);
win->destroyWin(); /* PMWndProc deletes win during WM_DESTROY */
WinDestroyMsgQueue(hmq);
WinTerminate(hab);
return 0;
}wmake -f Makefile.wat 2>&1 | tee compile.log
dmake -f makefile.gcc 2>&1 | tee compile.log
| File | Description |
|---|---|
lib\PMPP.LIB |
Static library (Open Watcom) |
dll\PMPP.DLL |
Dynamic library (Open Watcom) |
dll\PMPP_DLL.LIB |
Import library for the DLL |
lib\pmpp.a |
Static library (GCC/EMX) |
sample\test\TEST.EXE |
Hello World PM++ demonstration |
sample\bg_paint\BG_PAINT.EXE |
Background-paint / thread demo |
sample\provadlg\PROVADLG.EXE |
Dialog / help / print demo |
sample\popup\POPUP.EXE |
PMSubclassWin + PMPopupMenu demo |
Makefile.wat Open Watcom 2.0 build file (run from project root)
makefile.gcc GCC/EMX build file (dmake)
README.md This file
src\pmsys.h / pmsys.cpp Anchor block, message queue, threads, semaphores
src\pmwin.h / pmwin.cpp Window base classes and message routing
src\pmgpi.h / pmgpi.cpp GPI wrappers (fonts, device contexts, pres spaces)
src\pmdlg.h / pmdlg.cpp Dialog and control wrappers
src\pmhelp.h / pmhelp.cpp Help instance wrapper
src\pmstdres.h Standard menu/dialog/help resource ID constants
src\pmpp.df GCC/EMX DLL definition template
src\pmpp.def GCC/EMX generated module definition (regenerated by dmake)
obj\ Static library object files (Open Watcom)
obj_dll\ DLL object files (Open Watcom, -bd -DPMPP_DLL_BUILD)
lib\ PMPP.LIB static library output
dll\ PMPP.DLL + PMPP_DLL.LIB output
sample\test\ Hello World sample
sample\bg_paint\ Background-paint and thread demo
sample\provadlg\ Dialog, help, and print demo
sample\popup\ PMSubclassWin + PMPopupMenu demo
doc\ Original library documentation (pmpp.txt, readme.txt)
The original code targeted GCC/EMX. The following issues were found and resolved:
-
OS2EMX_PLAIN_CHAR— EMX-specific marker removed; replaced with#define INCL_PMwhich enables all PM definitions under Open Watcom'sos2.h. -
__const__(GCC extension) — Removed throughoutpmgpi.h. The OS/2 API functions underlying these wrappers already take non-const pointers, so the qualifier was decorative only. -
_threadstore()(EMX thread-local storage) — Replaced with a plainvoid* storemember onPMThread. Since eachPMThreadobject corresponds to exactly one thread, a member variable provides the same per-thread semantics without the EMX runtime dependency. -
ab.PMAnchorBlock(iab)— Calling a constructor directly on an existing object is a GCC extension not accepted by Open Watcom. Replaced with copy-assignment:ab = PMAnchorBlock(iab). -
friend PMPresSpace— Requires theclasskeyword in standard C++: changed tofriend class PMPresSpace. -
-bm(multi-threaded runtime) — Never use this flag for OS/2 PM builds with Open Watcom. The multi-threaded startup aborts silently beforemain()is reached. Single-threaded mode (-bmomitted) is correct. -
BOOL32— An EMX-only typedef. Addedtypedef ULONG BOOL32inpmsys.hwhen not already defined. -
#include <process.h>— Added inpmsys.cppfor_beginthread/_endthread. -
DLL export — Added
PMPP_EXPORTmacro (__declspec(dllexport)whenPMPP_DLL_BUILDis defined, empty otherwise) to all classes with non-inline methods. The DLL build compiles sources intoobj_dll\with-bd -DPMPP_DLL_BUILDand links withwlink system os2v2_dll option implib=dll\PMPP_DLL.LIB.
| Version | Date | Notes |
|---|---|---|
| 0.17 | 2026 | Open Watcom 2.0 port; DLL build (dll\PMPP.DLL); source moved to src\; popup sample added |
| 0.16 | 1996-04-25 | Last original GCC/EMX release by Giovanni Iachello |
| 0.15 | 1995-10-03 | |
| 0.08 | 1994-11-26 | First public release |
Copyleft Alike — original library by Giovanni Iachello (1994–1996).
See doc\pmpp.txt for full documentation and original license text.
Open Watcom 2.0 port (2026).