www.pudn.com > CHA05.rar > XSOCKCLIENT.CPP


///////////////////////////////////////////////////////////////////////////// 
//	Author				:	Bala Murali 
//	XSockClient.cpp		:	Implementation of CXSockClientApp and DLL registration. 
//	Creation Date		:	03/09/2000 
//	Version				:	Initial Release 
///////////////////////////////////////////////////////////////////////////// 
 
 
#include "stdafx.h" 
#include "XSockClient.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
 
CXSockClientApp NEAR theApp; 
 
const GUID CDECL BASED_CODE _tlid = 
		{ 0x2328f291, 0xdd85, 0x11d3, { 0xb4, 0xaf, 0, 0xc0, 0x4f, 0x2b, 0x30, 0xe } }; 
const WORD _wVerMajor = 1; 
const WORD _wVerMinor = 0; 
 
 
//////////////////////////////////////////////////////////////////////////// 
// CXSockClientApp::InitInstance - DLL initialization 
 
BOOL CXSockClientApp::InitInstance() 
{ 
	BOOL bInit = COleControlModule::InitInstance(); 
 
	if (bInit) 
	{ 
		if ( !AfxSocketInit() ) 
			return FALSE; 
	} 
 
	return bInit; 
} 
 
 
//////////////////////////////////////////////////////////////////////////// 
// CXSockClientApp::ExitInstance - DLL termination 
 
int CXSockClientApp::ExitInstance() 
{ 
	return COleControlModule::ExitInstance(); 
} 
 
 
///////////////////////////////////////////////////////////////////////////// 
// DllRegisterServer - Adds entries to the system registry 
 
STDAPI DllRegisterServer(void) 
{ 
	AFX_MANAGE_STATE(_afxModuleAddrThis); 
 
	if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid)) 
		return ResultFromScode(SELFREG_E_TYPELIB); 
 
	if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE)) 
		return ResultFromScode(SELFREG_E_CLASS); 
 
	return NOERROR; 
} 
 
 
///////////////////////////////////////////////////////////////////////////// 
// DllUnregisterServer - Removes entries from the system registry 
 
STDAPI DllUnregisterServer(void) 
{ 
	AFX_MANAGE_STATE(_afxModuleAddrThis); 
 
	if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor)) 
		return ResultFromScode(SELFREG_E_TYPELIB); 
 
	if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE)) 
		return ResultFromScode(SELFREG_E_CLASS); 
 
	return NOERROR; 
}