siarnetdlluser_t.cpp

来自「wangchuanDll.rar 网络传输的DLL 源代码」· C++ 代码 · 共 90 行

CPP
90
字号
//-------------------------------------------------------------------------
#include "siArNetDllUser_T.h" 
//-------------------------------------------------------------------------
//构造函数
ArNetDllUser_T::ArNetDllUser_T()
{


}
//-------------------------------------------------------------------------
//析构函数
ArNetDllUser_T::~ArNetDllUser_T()
{


}
//-------------------------------------------------------------------------

bool ArNetDllUser_T::LoadNetDll(void)
{
    bool bResult = false;
	m_hNetDll = ::LoadLibrary("NetDll.dll");
	if(m_hNetDll)	{		typedef ArNetFactory_T* (__stdcall* pCreateNetFactoryDef)(void*);		pCreateNetFactoryDef pCreateNetFactory = 0;		pCreateNetFactory = (pCreateNetFactoryDef)::GetProcAddress(m_hNetDll, "CreateNetFactory");		if(pCreateNetFactory) 		{			m_pNetFactory = (*pCreateNetFactory)("windows");            m_pNetTool = m_pNetFactory->CreateNetTool();
			bResult = true;		}	}
	return bResult;
}
//-------------------------------------------------------------------------

bool ArNetDllUser_T::FreeNetDll(void)
{
    if(m_hNetDll == 0)
	{		return false;	}
	bool bResult = false;
    typedef void*  (__stdcall* pDestroyNetFactoryDef)(ArNetFactory_T*);	pDestroyNetFactoryDef pDestroyNetFactory = 0;	pDestroyNetFactory = (pDestroyNetFactoryDef)::GetProcAddress(m_hNetDll, "DestroyNetFactory");
	if(pDestroyNetFactory)
	{
		(*pDestroyNetFactory)(m_pNetFactory);
		bResult = true;
	}	::FreeLibrary(m_hNetDll);
	return bResult;};

//-------------------------------------------------------------------------

bool  ArNetDllUser_T::Initial()
{
    return(LoadNetDll());

}
//-------------------------------------------------------------------------

bool  ArNetDllUser_T::Destroy()
{
    return(FreeNetDll());

}

//-------------------------------------------------------------------------
//获取模块版本信息
void   ArNetDllUser_T::GetDllDescription(char* strInfo)
{
	 typedef void  (__stdcall* pGetDllDescriptionDef)(char* );
	 pGetDllDescriptionDef pGetDllDescription = 0;
	 pGetDllDescription = (pGetDllDescriptionDef)::GetProcAddress(m_hNetDll, "GetDllDescription");
	 if(pGetDllDescription)
	{
		(*pGetDllDescription)(strInfo);
	}
};



⌨️ 快捷键说明

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