/***************************************************************************
**
**    $Header:   D:/EP196/SRC/LOG/SRCDLL/SRCDLL.CPP   1.0   15 Aug 1997 14:03:40   ZJRD  $
**
**    $Log:   D:/EP196/SRC/LOG/SRCDLL/SRCDLL.CPP  $
** 
**    Rev 1.0   15 Aug 1997 14:03:40   ZJRD
** Initial revision.
** 
**    Rev 1.1.7.0   19 Jun 1997 14:49:16   ZJRD
** 1.0c
** 
****************************************************************************/

// srcdll.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "srcdll.h"
#include "srcgbl.h"

#include "srcaddr.h"
#include "srcdata.h"
#include "srctext.h"
#include "srcbar.h"
#include "srcfrm.h"
#include "srcdoc.h"
#include "srcview.h"
#include "brwfrm.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// Initialization of MFC Extension DLL

#include <afxdllx.h>    // standard MFC Extension DLL routines

#define new DEBUG_NEW

static AFX_EXTENSION_MODULE NEAR extensionDLL = { NULL, NULL };

extern "C" int CALLBACK LibMain(HINSTANCE hInstance, WORD, WORD, LPSTR)
{
	// Extension DLL one-time initialization - do not allocate memory here,
	// use the TRACE or ASSERT macros or call MessageBox
	AfxInitExtensionModule(::extensionDLL, hInstance);

	return 1;   // OK
}

// Exported DLL initialization is run in context of running application
extern "C" void WINAPI InitDLL_SourceWindow()
{
	// create a new CDynLinkLibrary for this app
	new CDynLinkLibrary(::extensionDLL);

	// add other initialization here
}

void WINAPI SrcRegisterWindow()
{
	// Register Source
	CWinApp* pApp = AfxGetApp();
	ASSERT(pApp != NULL);
	::pSourceTemplate = new CMultiDocTemplate(
		IDR_SOURCE,
        RUNTIME_CLASS(CSourceDocument),
        RUNTIME_CLASS(CSourceFrame),
        RUNTIME_CLASS(CSourceView));
    pApp->AddDocTemplate(::pSourceTemplate);

	// Register Browse
	::pBrowseTemplate = new CMultiDocTemplate(
		IDR_BROWSE,
        RUNTIME_CLASS(CSourceDocument),
        RUNTIME_CLASS(CBrowseFrame),
        RUNTIME_CLASS(CSourceView));
    pApp->AddDocTemplate(::pBrowseTemplate);
}

HINSTANCE SrcGetDLLHandle()
{
	// Get the current DLL module handle
	return ::extensionDLL.hModule;
}
