WEB开发网
开发学院软件开发VC 编写在浏览器中不弹出警告的ActiveX控件 阅读

编写在浏览器中不弹出警告的ActiveX控件

 2006-07-22 22:02:53 来源:WEB开发网   
核心提示: STDAPI DllRegisterServer(void){HRESULT hr;AFX_MANAGE_STATE(_afxModuleAddrThis);if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid))return R
STDAPI DllRegisterServer(void)
{
  HRESULT hr;
  AFX_MANAGE_STATE(_afxModuleAddrThis);
  if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid))
    return ResultFromScode(SELFREG_E_TYPELIB);
  if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE))
    return ResultFromScode(SELFREG_E_CLASS);
  // 标记控件初始化安全.
  // 创建初始化安全组件种类
  hr = CreateComponentCategory(CATID_SafeForInitializing, L"Controls safely initializable from persistent data!");
  if (FAILED(hr))
    return hr;
  // 注册初始化安全
  hr = RegisterCLSIDInCategory(CLSID_SafeItem, CATID_SafeForInitializing);
  if (FAILED(hr))
    return hr;
  // 标记控件脚本安全
  // 创建脚本安全组件种类
  hr = CreateComponentCategory(CATID_SafeForScripting, L"Controls safely scriptable!");
  if (FAILED(hr))
    return hr;
  // 注册脚本安全组件种类
  hr = RegisterCLSIDInCategory(CLSID_SafeItem, CATID_SafeForScripting);
  if (FAILED(hr))
    return hr;
  return NOERROR;
}

// DllUnregisterServer - Removes entries from the system registry

STDAPI DllUnregisterServer(void)
{
  HRESULT hr;
  AFX_MANAGE_STATE(_afxModuleAddrThis);
  if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor))
    return ResultFromScode(SELFREG_E_TYPELIB);
  if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE))
    return ResultFromScode(SELFREG_E_CLASS);
  // 删除控件初始化安全入口.
  hr=UnRegisterCLSIDInCategory(CLSID_SafeItem, CATID_SafeForInitializing);
  if (FAILED(hr))
    return hr;
  // 删除控件脚本安全入口
  hr=UnRegisterCLSIDInCategory(CLSID_SafeItem, CATID_SafeForScripting);
  if (FAILED(hr))
    return hr;
//////////////////////////
  return NOERROR;
}

(全文完)

上一页  1 2 3 

Tags:编写 浏览器 警告

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接