/****************************************************************/
/*								*/
#define PRGN	"ABOUT.C"
#define PRGMOD	"01/05/1987	17:55:58"
#define PRGCRT	"12/20/1986	09:01:42"
/*	Copyright (C) 1986, Alan Cooper - All Rights Reserved.	*/
/*								*/
/*	"About..." Handler.					*/
/*								*/
/****************************************************************/
#include "windows.h"
#include "personal.h"
#include "about.equ"
/****************************************************************
*								*
*	Declaratives.						*
*								*
*****************************************************************/
/* procedure headers are in personal.h */
/****************************************************************
*								*
*	Private (Local Static) Variables.			*
*								*
*****************************************************************/
PRIVATE struct
{
	HANDLE inst;
	FARPROC about_dialog;		/* AboutBox Dialog handler */
	STRING about_item[WRKSTRLEN];
} pvt;


/****************************************************************
*								*
*	Called once from WinMain.				*
*	Initialize this module.					*
*								*
*****************************************************************/
BOOL init_about_box(hInstance,hPrevInstance,hWnd)
HANDLE hInstance;
HANDLE hPrevInstance;
HWND hWnd;
{
	HMENU hMenu;

	pvt.inst = hInstance;
	pvt.about_dialog = MakeProcInstance(WndProc_dlg_about,pvt.inst);
	if (hPrevInstance)
	{
	  GetInstanceData(hPrevInstance,pvt.about_item,WRKSTRLEN);
	}
	else
	{
	  LoadString(pvt.inst,ITEM_ABOUT,pvt.about_item,WRKSTRLEN);
	}
	hMenu = GetSystemMenu(hWnd,FALSE);
/* Add the separator line: */
	ChangeMenu(
		hMenu,		/* the menu */
		0,		/* wIDChangeItem: id of item to change */
		NULL,		/* lpNewItem: pointer to new item */
		999,		/* wIDNewItem: id of new item */
		MF_APPEND | MF_SEPARATOR);	/* wChange: */
/* Add the "About..." entry: */
	ChangeMenu(
		hMenu,		/* the menu */
		0,		/* wIDChangeItem: id of item to change */
		pvt.about_item,	/* lpNewItem: pointer to new item */
		SCMD_ABOUT,	/* wIDNewItem: id of new item */
		MF_APPEND | MF_STRING);	/* wChange: */
	return (TRUE);
}


/****************************************************************
*								*
*	The WndProc_main calls here on a "SCMD_ABOUT" message	*
*	from the ventilator.					*
*	Process a Request for About Box.			*
*								*
*****************************************************************/
LONG do_about_box(hWnd,message,wParam,lParam)
HWND hWnd;
UNSIGNED message;
WORD wParam;
LONG lParam;
{
	DialogBox(pvt.inst,MAKEINTRESOURCE(DLG_ABOUT),
			hWnd,pvt.about_dialog);
	return (0L);
}

/****************************************************************
*								*
*	System vectors here on input to the About window.	*
*								*
*****************************************************************/
BOOL FAR PASCAL WndProc_dlg_about(hDlg,message,wParam,lParam)
HWND hDlg;
UNSIGNED message;
WORD wParam;
LONG lParam;
{
	if (message == WM_COMMAND)
	{
	  EndDialog(hDlg, TRUE);
	  return (TRUE);
	}
	else if (message == WM_INITDIALOG)
	  return (TRUE);
	else
	  return (FALSE);
}
