/*
*********************************************************************
*
*	The Essence of OLE
*
*	Source code sample
*
*	Copyright (c) 1996, Rolling Thunder Computing, Ipswich MA
*
*	e-mail: essence@rollthunder.com
*	CompuServe: 73540,3430
*	Web: http://www.rollthunder.com
*
*	File Name: DLLMAIN.CPP
*
*	Purpose: DLL Entry point for IEliza custom marshaling proxy
*
*********************************************************************
*/

/*
*****************************************************************************
System header files
*****************************************************************************
*/

#include	<windows.h>

/*
*****************************************************************************
Application header files
*****************************************************************************
*/

#include "iclassf.h"


/*
*****************************************************************************
Function prototype files
*****************************************************************************
*/


/*
*****************************************************************************
Global Variables defined here
*****************************************************************************
*/

CClassFactory cf ;

/*
Class ID for the Eliza object
*/

// {E8D73100-C4F9-11ce-AD55-00608C86B89C}
static const GUID GUID_ElizaObject = 
{ 0xe8d73100, 0xc4f9, 0x11ce, { 0xad, 0x55, 0x0, 0x60, 0x8c, 0x86, 0xb8, 0x9c } };



/*
*****************************************************************************
EXTERNS of global variables defined in other files
*****************************************************************************
*/


/*
**************************************************************************
*
*		Function Name:  WinMain
*
*		Purpose: initializes, processes message loop
*        Windows recognizes this function by name as the initial entry point
*        for the program.  This function calls the application initialization
*        routine, if no other instance of the program is running, and always
*        calls the instance initialization routine.  It then executes a message
*        retrieval and dispatch loop that is the top-level control structure
*        for the remainder of execution.  The loop is terminated when a WM_QUIT
*        message is received, at which time this function exits the application
*        instance by returning the value passed by PostQuitMessage().
*
*
*		Calling Parmeters, provided automatically by Windows
*			HANDLE hInstance:	 current instance	handle
*			HANDLE hPrevInstance: previous instance handle
*			LPSTR lpCmdLine: command line
*			int nCmdShow:  show-window type (open/icon)
*
*		Returns:
*			NULL if terminated before window message loop activates, otherwise
*			value provided by call elsewhere to PostQuitMessage
*
*		Global Variables Used:
*			Sets values for hIWWInst and IWWMainWindow, used by many other fns
*
*		Side Effects: None Known
*
*		Caveats: None Known
*
*
**************************************************************************
*/

int ObjectCount = 0, LockCount = 0 ;

__declspec (dllexport) BOOL WINAPI DllMain (HINSTANCE hInst, DWORD why, LPVOID reserved)
{

	if (why == DLL_PROCESS_ATTACH)
	{					
	}
	else if (why == DLL_PROCESS_DETACH)
	{
	}


	return TRUE ;
}



STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID FAR* ppv)
{
/*
Take our hard-wired class factory and call QueryInterface on it, on
behalf of the COM that called this function.
*/

	return cf.QueryInterface (riid, ppv) ;

}

STDAPI DllCanUnloadNow(void)
{
	if (ObjectCount == 0 && LockCount == 0) 
	{
		return S_OK ;
	}
	else
	{
		return ResultFromScode (S_FALSE) ;
	}

	return 0 ;
}

