由云台协议DLL浅谈插件程序的编写(上)【原创】[4]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 waterpub 的 blog

         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

本文关键:由云台协议DLL浅谈插件程序的编写(上)【原创】
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top