许可证持有人c++的示例

CLicenseHolder{受保护的:CComPtr < IltmsLicenseManager > m_licmgr;BOOL m_service;BOOL m_verbose;装运箱m_title;BOOL IsDisplayEnabled (无效){返回(m_verbose & & ! m_service);}intDisplayLicenseError (LPCTSTR消息){返回::弹出窗口(NULL,消息、m_title MB_OK | MB_ICONERROR);}公共:CLicenseHolder (BOOL verbose = TRUE, LPCTSTR标题= _T (“领导媒体服务器”):m_service(假),m_verbose(详细),m_title(标题){HWINSTA hWindowStation = GetProcessWindowStation ();USEROBJECTFLAGS旗帜;DWORD dwLength = 0;GetUserObjectInformation (hWindowStation UOI_FLAGS (PVOID)旗帜,运算符(USEROBJECTFLAGS) &dwLength);如果(!(旗帜。dwFlags & WSF_VISIBLE))m_service = TRUE;}虚拟~ CLicenseHolder (){}HRESULT LoadLicenseManager (无效){如果(m_licmgr !){HRESULT人力资源;hr = CoCreateInstance (__uuidof (ltmsLicenseManager), NULL, CLSCTX_ALL, __uuidof (IltmsLicenseManager), (无效* *)&m_licmgr);如果(失败(人力资源){如果(IsDisplayEnabled ()){DisplayLicenseError (_T (“不能实例化LEADTOOLS流媒体许可管理器”));}返回人力资源;}}返回S_OK;}HRESULT SetLicense (LPCTSTR许可证= _T (“% ltmsAppFolder % \ \ LEADTOOLS.LIC”),LPCTSTR关键= _T (“% ltmsAppFolder % \ \ LEADTOOLS.LIC.KEY”),长标志= ltmsSetLicenseFlags_LicenseIsFile | ltmsSetLicenseFlags_KeyIsFile){HRESULT人力资源;hr = LoadLicenseManager ();如果(失败(人力资源)返回人力资源;hr = m_licmgr - > SetLicense (CComBSTR(许可),CComBSTR(关键),国旗);如果(失败(人力资源){如果(IsDisplayEnabled ()){DisplayLicenseError (_T (“你的许可文件丢失,无效或过期。LEADTOOLS流媒体库功能。请联系领导销售信息获取一个有效的许可证”。));ShellExecute (NULL, _T (“开放”),_T (“//m.ahtuanjie.com/downloads/evaluation-form.asp?evallicenseonly=true”),零,零,1);}返回人力资源;}返回S_OK;}无效UnloadLicenseManager (无效){m_licmgr =零;}};
LEADTOOLS流媒体C API的帮助
188金宝搏的网址客服|支持|联系我们|知识产权的通知
©1991 - 2021领先的技术公司。保留所有权利。