This example transfers a pointer from the application-defined data area of a dialog window to the application-defined data area (window word) of a main window. The pointer is then retrieved.
#define INCL_WINWINDOWMGR #include <OS2.H> HWND hwndClient; ULONG msg; MPARAM pParm, mp1, mp2; /* Inside dialog procedure */ switch( msg ) { case WM_INITDLG: /* This points to the data area and is passed by */ /* WinLoadDlg, WinCreateDlg, and WinDlgBox */ /* in their pCreateParams parameter. */ pParm = (MPARAM)mp2; /* Place the pointer in the window word area */ WinSetWindowULong(hwndClient, QWL_USER, (ULONG) pParm); case WM_COMMAND: switch (SHORT1FROMMP(mp1)) { case DID_OK: /* Retrieve the pointer from the window word area */ pParm = (MPARAM)WinQueryWindowULong(hwndClient, QWL_USER); } }