#include "ICommonDll.h"
typedef BOOL (*ProcType)(VOID **) ;
void CTestDllDlg::OnButton1()
{
// TODO: Add your control notification handler code here
HMODULE hDll = LoadLibrary( "E:\\DLl_House\\Common\\Debug\\Common.dll" ) ;
if ( hDll == NULL )
{
ASSERT ( "load dll faile" == NULL ) ;
return ;
}
ProcType pt = (ProcType)GetProcAddress( hDll, "QueryInterface" ) ;
if ( pt == NULL )
{
ASSERT ( "point QueryInterface faile " == NULL ) ;
return ;
}
ICommonDll * pI = NULL ;
BOOL bOK = pt( (void**)&pI ) ;
if ( pI == NULL )
{
ASSERT ( "" == NULL ) ;
return ;
}
CString str ;
pI->InitInstance() ;
str = pI->GetCurTime() ;
pI->IsFileExist( "E:\\DLl_House\\Common\\ICommonDll.h" ) ;
HANDLE hFile = NULL ;
pI->PrintLog( hFile, "sdfsdf" ) ;
pI->GetAppPath() ;
pI->Release() ;
pI = NULL ;
FreeLibrary( hDll ) ;
}
typedef BOOL (*ProcType)(VOID **) ;
BOOL CBus::LoadDll( CString strDllName, VOID** ppData )
{
m_hDll = LoadLibrary( strDllName ) ;
if ( m_hDll == NULL )
{
ASSERT ( "load dll faile" == NULL ) ;
return FALSE;
}
ProcType pt = (ProcType)GetProcAddress( m_hDll, "QueryInterface" ) ;
if ( pt == NULL )
{
ASSERT ( "point QueryInterface faile " == NULL ) ;
return FALSE;
}
BOOL bOK = pt( (void**)ppData ) ;
if ( ppData == NULL )
{
ASSERT ( "" == NULL ) ;
return FALSE;
}
return TRUE ;
}