#pragma	title("Multi Window Example  --  Version 1.0  --  (MultiWin.C)")
#pragma	subtitle("   main( ) - Interface Definitions")

#define	INCL_DOS		   /* Include OS/2 DOS Kernal		*/
#define	INCL_WIN		   /* Include OS/2 PM Windows Interface	*/

#if defined(__IBMC__)

#pragma	info(nopar, noext)

#endif

#include <os2.h>

#include "appdefs.h"
#include "multiwin.h"

/* This	module contains	main( )	entry point to the application.		*/

/* Filename:   MultiWin.C						*/

/*  Version:   1.0							*/
/*  Created:   1994-08-18						*/
/*  Revised:   1994-08-18						*/

/* Routines:								*/


/* Copyright ¸ 1994  Prominare Inc.  All Rights	Reserved.		*/

/* --------------------------------------------------------------------	*/

/************************************************************************/
/************************************************************************/
/*		       DISCLAIMER OF WARRANTIES.			*/
/************************************************************************/
/************************************************************************/
/*     The following [enclosed]	code is	library	code created by		*/
/*     Prominare Inc.  This library code is  provided to you solely	*/
/*     for the purpose of assisting you	in the development of your	*/
/*     applications.  The code is provided "AS IS", without		*/
/*     warranty	of any kind.  Prominare	Inc. shall not be liable	*/
/*     for any damages arising out of your use of the library code,	*/
/*     even if they have been advised of the possibility of such	*/
/*     damages.								*/
/************************************************************************/
/************************************************************************/

PSZ pszCapChildClassName = "CapChild";
PSZ pszChildWinClassName = "ChildWin";
PSZ pszMultiWndClassName = "MultiWnd";

INT main(INT argc, CHAR	*argv[ ])

{
QMSG  qmsg;			   /* PM Message Queue Holder		*/

		       /* Initialize the program for PM	and create the	*/
		       /* message queue					*/

hmqMultiWnd = WinCreateMsgQueue(hAB = WinInitialize(0),	0);

		       /* Register the window class			*/

if ( !WinRegisterClass(hAB, pszMultiWndClassName, (PFNWP)MultiWndProc,
		       CS_SYNCPAINT | CS_SIZEREDRAW, 0)	)
   return(0);

		       /* Register the window class			*/

if ( !WinRegisterClass(hAB, pszChildWinClassName, (PFNWP)ChildWndProc,
		       CS_SYNCPAINT | CS_SIZEREDRAW, 0)	)
   return(0);

		       /* Register the window class			*/

if ( !WinRegisterClass(hAB, pszCapChildClassName, (PFNWP)CapChildWinProc,
		       CS_SYNCPAINT | CS_SIZEREDRAW, 0)	)
   return(0);

		       /* Create the main program window		*/

if ( !(hwndMultiWndFrame = CreateStdWindow(HWND_DESKTOP, WS_VISIBLE,
					   FCF_NOBYTEALIGN | FCF_SHELLPOSITION |
					   FCF_TITLEBAR	| FCF_ICON |
					   FCF_SYSMENU | FCF_MENU | FCF_MINMAX |
					   FCF_ACCELTABLE | FCF_SIZEBORDER,
					   pszMultiWndClassName, "Multi-Window Example", 0L,
					   (HMODULE)NULL, ID_WINDOW, &hwndMultiWnd, 10,	23, 343, 196)) )
   return(0);

		       /* Create the main program window		*/

if ( !(hwndChildWinFrame = CreateStdWindow(HWND_DESKTOP, WS_VISIBLE,
					   FCF_NOBYTEALIGN | FCF_TITLEBAR |
					   FCF_SYSMENU | FCF_MENU |
					   FCF_SIZEBORDER,
					   pszChildWinClassName, "Child Window", 0L,
					   (HMODULE)NULL, ID_CHILD, &hwndChildWin, 6, 22, 343, 196)) )
   return(0);

		       /* Create secondary window			*/

if ( !(hwndCapChildFrame = CreateStdWindow(hwndMultiWnd, WS_VISIBLE,
					   FCF_NOBYTEALIGN | FCF_TITLEBAR |
					   FCF_SYSMENU | FCF_BORDER,
					   pszCapChildClassName, "Captive Child", 0L,
					   (HMODULE)NULL, 0, &hwndCapChild, 52,	32, 105, 47)) )
   return(0);

while (	WinGetMsg(hAB, &qmsg, (HWND)NULL, 0, 0)	)
   WinDispatchMsg(hAB, &qmsg);

		       /* Have received	a WM_QUIT, start the program	*/
		       /* shutdown by destroying the program windows	*/
		       /* and destroying the message queue		*/

WinDestroyWindow(hwndMultiWndFrame);
WinDestroyWindow(hwndChildWinFrame);
WinDestroyWindow(hwndCapChildFrame);
WinDestroyMsgQueue(hmqMultiWnd);

		       /* Notify PM that main program thread not needed	*/
		       /* any longer					*/
WinTerminate(hAB);
		       /* Exit back to OS/2 cleanly			*/
return(0);
}
