假设需要调用的动态链接库接口为
int UserStartAutoMark(CString RadioCheckType,
CString dllpath,
CString ProductSettings,
CString strPdfPath_in,
CString strPostProcessDllPath_in,
CString strFileAutoPath_in,
CString strFileCatalogPath_in,
CString& strErrMsg_out)
在需要调用动态链接库的文件中,添加以下代码
typedef int Func_StartAutoMark(CString RadioCheckType,
CString dllpath,
CString ProductSettings,
CString strPdfPath_in,
CString strPostProcessDllPath_in,
CString strFileAutoPath_in,
CString strFileCatalogPath_in,
CString& strErrMsg_out);//一般放在文件的开头处
HINSTANCE hDll =AfxLoadLibrary(strAM_AutoMarkAppDll);//strAM_AutoMarkAppDll为动态链接库位置
Func_StartAutoMark* pFunc_StartAutoMark_New = (Func_StartAutoMark*)::GetProcAddress(hDll, "UserStartAutoMark");
int m_result=pFunc_StartAutoMark_New(RadioCheck_in,DllPath,SettingsPath_in,
PdfPath_in,strPostProcessDllPath_in,
strFileAutoPath_in, strFileCatalogPath_in,strErrMsg);
AfxFreeLibrary(hDll);
hDll=NULL;