描述:
写了一个activex,里面需要调用一个dll,active里面调用dll的语句是这样的:
typedef bool (WINAPI * TESTDLL)(CString CS1,CString CS2);
HINSTANCE hmod;
hmod = ::LoadLibrary ("dlltest.dll");
int ierr=GetLastError();
CString debugg;
debugg.Format("%d",ierr);
AfxMessageBox(debugg);//弹出错误,表明没有找到dll
if(hmod==NULL)
{
AfxMessageBox("Fail");
}
TESTDLL lpproc;
lpproc = (TESTDLL)GetProcAddress (hmod,"StrSeparator");//这是dll里面的函数
ierr=GetLastError();
AfxMessageBox("Fail9");
debugg.Format("%ddd",ierr);
AfxMessageBox(debugg);//弹出错误,表明没有找到进程地址
bool flag=((TESTDLL)lpproc)(oldversion,m_keyvalue);
ierr=GetLastError();
debugg.Format("%ddd",ierr);
AfxMessageBox(debugg);
FreeLibrary(hmod);
编译完成以后,我把ocx,dll,inf文件打包进入cab中,inf中的描述如下:
[Add.Code]
dlltest.dll=dlltest.dll
eWebInstaller.ocx=eWebInstaller.ocx
[eWebInstaller.ocx]
file-win32-x86=thiscab
clsid={D256315E-CDAE-4CA0-974C-5D85C36346F5}
RegisterServer=yes
[dlltest.dll]
file-win32-x86=thiscab
clsid={D256315E-CDAE-4CA0-974C-5D85C36346F5}
RegisterServer=yes
但是打开包含这个activex的网页以后,会报错,我看了一下错误码,指示dll没有找到,到底哪里出了问题,是ocx的问题,还是inf的问题?怎样解决呢