MYSTRUCT *MyStruct; : switch (ulMsg) /* Switch on message class */ { case WM_CREATE: WinDefWindowProc(hWnd, /* Perform default init */ ulMsg, mp1, mp2); DosAllocMem(MyStruct, /* Allocate memory object */ sizeof(MYSTRUCT), /* Size of memory object */ PAG_READ | /* Allow read access */ PAG_WRITE | /* Allow write access */ PAG_COMMIT); /* Commit storage now */ hFrame=WinQueryWindow(hwnd, /* Get frame window handle */ QW_PARENT, FALSE); WinSetWindowULong(hFrame, /* Place pointer in window */ QWL_USER, /* words */ (ULONG)MyStruct); return((MRESULT)0); break; :
This example shows the allocation of a memory object, and the storage of a pointer to that memory object in window words.