1 #include "stdafx.h" 2 #include "DllLib.h" 3 4 CDllLib()5CDllLib::CDllLib() 6 { 7 } 8 9 ~CDllLib()10CDllLib::~CDllLib() 11 { 12 } 13 Init(const wstring & dll_path)14void CDllLib::Init(const wstring & dll_path) 15 { 16 //载入DLL 17 m_dll_module = ::LoadLibrary(dll_path.c_str()); 18 //获取函数入口 19 bool rtn = false; 20 if(m_dll_module != NULL) 21 rtn = GetFunction(); 22 //判断是否成功 23 m_success = (m_dll_module != NULL && rtn); 24 } 25 UnInit()26void CDllLib::UnInit() 27 { 28 if (m_dll_module != NULL) 29 { 30 FreeLibrary(m_dll_module); 31 m_dll_module = NULL; 32 } 33 } 34 IsSucceed()35bool CDllLib::IsSucceed() 36 { 37 return m_success; 38 } 39