m_pdllload =0;
}
bool openplugin(lpctstr lpszname) // 打开插件,如果是有效的插件返回true,否则false
{
if (m_pdllload)
close();
else
{
m_pdllload = new cdllload();
m_pdllload->open(lpszname);
}
m_pfncreateptzinstance = (create_ptz_instance)m_pdllload->getprocaddress("createptzinstance");
m_ppprotocolsname = (const char **)m_pdllload->getprocaddress("protocolnames");
return (m_ppprotocolsname && m_ppprotocolsname[0]);
}
void close()
{
m_pfncreateptzinstance = 0;
m_ppprotocolsname = 0;
if (m_pdllload)
m_pdllload->close();
}
const char ** getsupportprotocols()
{
return m_ppprotocolsname;
}
cptzinterface * createptzinstance(lpctstr lpszprotolname) // 根据该插件内的某个协议产生出一个对象
{
if (m_pfncreateptzinstance)
{
return m_pfncreateptzinstance(lpszprotolname);
}
return 0;
}
private:
cdllload * m_pdllload;
create_ptz_instance m_pfncreateptzinstance;
const char ** m_ppprotocolsname;
};
cplugininfo类:src\ptz_test\controls\ptzprotocolfind.h和src\ptz_test\controls\ptzprotocolfind.cpp