The following code illustrates processing a modal secondary window by dispatching messages while the modal window is displayed.
#define INCL_SW
#include <os2me.h>
HWND hwndFrame;
hwndFrame = WinLoadSecondaryWindow (HWND_DESKTOP, /* Parent window */
HWND_DESKTOP, /* Owner window */
MyDlgProc, /* Dialog proc */
NULL, /* Module handle */
ID_DIALOG, /* Resource ID */
NULL); /* Create params */
WinProcessSecondaryWindow (hwndFrame);