/*----------------------------------------------------- PMSTUB.C -- A Program that Creates a Client Window -----------------------------------------------------*/ #define INCL_DOS #define INCL_GPI #define INCL_WIN #include "os2.h" #include #include #include #include #define PASFAR pascal far HAB hab; HPS hps; HWND hwndframe, hwndclient, hwmsgbox; int PASFAR debug_puts(char far *txt); MRESULT EXPENTRY wndproc (HWND, USHORT, MPARAM, MPARAM) ; int main (void) { static CHAR name [] = "pmstub" ; static ULONG fl = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX | FCF_SHELLPOSITION | FCF_TASKLIST ; HMQ hmq ; QMSG qmsg ; printf("\n*** START TEST ***\n"); hab = WinInitialize (0) ; hmq = WinCreateMsgQueue (hab, 0) ; WinRegisterClass ( hab, /* Anchor block handle */ name, /* Name of class being registered */ wndproc, /* Window procedure for class */ 0L, /* Class style */ 0) ; /* Extra bytes to reserve */ hwndframe = WinCreateStdWindow ( HWND_DESKTOP, /* Parent window handle */ WS_VISIBLE, /* Style of frame window */ &fl, /* Pointer to control data */ name, /* Client window class name */ NULL, /* Title bar text */ 0L, /* Style of client window */ NULL, /* Module handle for resources */ 0, /* ID of resources */ &hwndclient) ; /* Pointer to client window handle */ while (WinGetMsg (hab, &qmsg, NULL, 0, 0)) WinDispatchMsg (hab, &qmsg) ; WinDestroyWindow (hwndframe) ; WinDestroyMsgQueue (hmq) ; WinTerminate (hab) ; printf("\n*** END TEST ***\n"); return 0 ; } int printf(const char *txt,...) { char _buffer[400], *p; va_list array; if (strchr(txt,'%')) { va_start(array,txt); vsprintf(_buffer, txt, array); } else strcpy(_buffer,txt); debug_puts(_buffer); } writequeue(char far *txt, USHORT mode, USHORT len) { SEL selector, qownersel; char far *p; char far *ptr; int i; static HQUEUE hq=NULL; static char queuename[] = "\\QUEUES\\PMDEBUG"; static int pid; if (!hq && DosOpenQueue((USHORT*)&pid, &hq, queuename)) return -1; if (DosAllocSeg( len, &selector,SEG_GIVEABLE)) return -2; ptr = MAKEP(selector,0); for (i=0; i