netmoduleinterface.cpp

来自「用事件方式」· C++ 代码 · 共 47 行

CPP
47
字号
// NetModuleInterface.cpp: implementation of the CNetModuleInterface class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "NetModuleInterface.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CString CNetModuleInterface::GetCurrentPath()
{
	char path[MAX_PATH];
	::GetModuleFileName(NULL,path,MAX_PATH);
	
	CString strPath(path);

	strPath=strPath.Left(strPath.ReverseFind('\\')+1);

	return strPath;
}
CNetModuleInterface::CNetModuleInterface()
{
	CString strPath=GetCurrentPath();
	strPath+=NetModuleInterfaceDLLName;

	hModule=LoadLibrary(strPath);

	StartServer			=(STARTSERVER)			GetProcAddress(hModule,"StartServer");
	StopServer			=(STOPSERVER)			GetProcAddress(hModule,"StopServer");
	SetNetInterfaceInfo	=(SETNETINTERFACEINFO)	GetProcAddress(hModule,"SetNetInterfaceInfo");
	ReadData			=(READDATA)				GetProcAddress(hModule,"ReadData");
	SendData			=(SENDDATA)				GetProcAddress(hModule,"SendData");
}

CNetModuleInterface::~CNetModuleInterface()
{
	FreeLibrary(hModule);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?