Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LIB-PM-PM-Plus-Plus

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.

Class Hierarchy

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

Using the Library

Static library (Open Watcom)

  1. Add src\ to your include path.
  2. Link against lib\PMPP.LIB.
  3. Subclass PMWin (or PMMainWin) and override the virtual handlers you need (paint(), command(), kbd(), mouse(), closed(), etc.).
  4. Heap-allocate your window object — PMWndProc calls delete win automatically when WM_DESTROY fires.

DLL (Open Watcom)

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.

Quick example

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;
}

Building from Source

Open Watcom 2.0

wmake -f Makefile.wat 2>&1 | tee compile.log

GCC/EMX

dmake -f makefile.gcc 2>&1 | tee compile.log

Outputs

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

File Layout

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)

Open Watcom 2.0 Porting Notes

The original code targeted GCC/EMX. The following issues were found and resolved:

  • OS2EMX_PLAIN_CHAR — EMX-specific marker removed; replaced with #define INCL_PM which enables all PM definitions under Open Watcom's os2.h.

  • __const__ (GCC extension) — Removed throughout pmgpi.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 plain void* store member on PMThread. Since each PMThread object 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 the class keyword in standard C++: changed to friend class PMPresSpace.

  • -bm (multi-threaded runtime) — Never use this flag for OS/2 PM builds with Open Watcom. The multi-threaded startup aborts silently before main() is reached. Single-threaded mode (-bm omitted) is correct.

  • BOOL32 — An EMX-only typedef. Added typedef ULONG BOOL32 in pmsys.h when not already defined.

  • #include <process.h> — Added in pmsys.cpp for _beginthread / _endthread.

  • DLL export — Added PMPP_EXPORT macro (__declspec(dllexport) when PMPP_DLL_BUILD is defined, empty otherwise) to all classes with non-inline methods. The DLL build compiles sources into obj_dll\ with -bd -DPMPP_DLL_BUILD and links with wlink system os2v2_dll option implib=dll\PMPP_DLL.LIB.

Changelog

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

License

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).

About

PM++ is a freeware class library that encapsulates some of the OS/2 Presentation Manager API calls.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages