home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1999 January
/
pcwk_01_1999.iso
/
Wtestowe
/
Vistdstd
/
Install
/
Data.Z
/
MFC4_vsl.AWX
/
TEMPLATE
/
DLLROOT.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1997-03-07
|
3KB
|
123 lines
// $$root$$.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
$$IF(EXTDLL)
#include <afxdllx.h>
$$ELSE // !EXTDLL
#include "$$root$$.h"
$$ENDIF //!EXTDLL
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
$$IF(EXTDLL)
static AFX_EXTENSION_MODULE $$safe_root$$DLL = { NULL, NULL };
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
TRACE0("$$ROOT$$.DLL Initializing!\n");
$$IF(VERBOSE)
// Extension DLL one-time initialization
$$ENDIF
AfxInitExtensionModule($$safe_root$$DLL, hInstance);
$$IF(VERBOSE)
// Insert this DLL into the resource chain
$$ENDIF
new CDynLinkLibrary($$safe_root$$DLL);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
TRACE0("$$ROOT$$.DLL Terminating!\n");
}
$$IF(VERBOSE)
return 1; // ok
$$ELSE
return 1;
$$ENDIF
}
$$ELSE //!EXTDLL
/////////////////////////////////////////////////////////////////////////////
// $$APP_CLASS$$
BEGIN_MESSAGE_MAP($$APP_CLASS$$, $$APP_BASE_CLASS$$)
//{{AFX_MSG_MAP($$APP_CLASS$$)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// $$APP_CLASS$$ construction
$$APP_CLASS$$::$$APP_CLASS$$()
{
$$IF(VERBOSE)
// TODO: add construction code here,
// Place all significant initialization in InitInstance
$$ENDIF
}
/////////////////////////////////////////////////////////////////////////////
// The one and only $$APP_CLASS$$ object
$$APP_CLASS$$ theApp;
$$IF(AUTOMATION || SOCKETS)
/////////////////////////////////////////////////////////////////////////////
// $$APP_CLASS$$ initialization
BOOL $$APP_CLASS$$::InitInstance()
{
$$IF(SOCKETS)
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
$$ENDIF //SOCKETS
$$IF(AUTOMATION)
// Register all OLE server (factories) as running. This enables the
// OLE libraries to create objects from other applications.
COleObjectFactory::RegisterAll();
$$ENDIF //AUTOMATION
return TRUE;
}
$$ENDIF //AUTOMATION || SOCKETS
$$IF(AUTOMATION)
/////////////////////////////////////////////////////////////////////////////
// Special entry points required for inproc servers
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return AfxDllGetClassObject(rclsid, riid, ppv);
}
STDAPI DllCanUnloadNow(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return AfxDllCanUnloadNow();
}
// by exporting DllRegisterServer, you can use regsvr.exe
STDAPI DllRegisterServer(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
COleObjectFactory::UpdateRegistryAll();
return S_OK;
}
$$ENDIF //AUTOMATION
$$ENDIF //EXTDLL