快速业务通道

如何将CB创建的Activex设定为脚本安全

作者 佚名技术 来源 程序设计 浏览 发布时间 2012-06-29

深入解析ATL上就有,可惜我来晚了,昨天刚解决这个问题。

写在这个里面的public,就可以了

class ATL_NO_VTABLE TSignActiveFormXImpl:
  VCLCONTROL_IMPL(TSignActiveFormXImpl, SignActiveFormX, TSignActiveFormX, ISignActiveFormX, DIID_ISignActiveFormXEvents)
{
  void __fastcall ActivateEvent(TObject *Sender);
  void __fastcall ClickEvent(TObject *Sender);
  void __fastcall CreateEvent(TObject *Sender);
  void __fastcall DblClickEvent(TObject *Sender);
  void __fastcall DeactivateEvent(TObject *Sender);
  void __fastcall DestroyEvent(TObject *Sender);
  void __fastcall KeyPressEvent(TObject *Sender, char &Key);
  void __fastcall PaintEvent(TObject *Sender);
public:
  void InitializeControl()
  {
   m_VclCtl->OnActivate = ActivateEvent;
   m_VclCtl->OnClick = ClickEvent;
   m_VclCtl->OnCreate = CreateEvent;
   m_VclCtl->OnDblClick = DblClickEvent;
   m_VclCtl->OnDeactivate = DeactivateEvent;
   m_VclCtl->OnDestroy = DestroyEvent;
   m_VclCtl->OnKeyPress = KeyPressEvent;
   m_VclCtl->OnPaint = PaintEvent;
  }
// The COM MAP entries declares the interfaces your object exposes (through
// QueryInterface). CComRootObjectEx::InternalQueryInterface only returns
// pointers for interfaces in the COM map. VCL controls exposed as OCXes
// have a minimum set of interfaces defined by the
// VCL_CONTROL_COM_INTERFACE_ENTRIES macro. Add other interfaces supported
// by your object with additional COM_INTERFACE_ENTRY[_xxx] macros.
//
BEGIN_COM_MAP(TSignActiveFormXImpl)
  VCL_CONTROL_COM_INTERFACE_ENTRIES(ISignActiveFormX)
END_COM_MAP()
//在这里,看到了吗?
BEGIN_CATEGORY_MAP(CYourComObject)
  IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
  IMPLEMENTED_CATEGORY(CATID_SafeForInitializing)
END_CATEGORY_MAP()
// The PROPERTY map stores property descriptions, property DISPIDs,
// property page CLSIDs and IDispatch IIDs. You may use use
// IPerPropertyBrowsingImpl, IPersistPropertyBagImpl, IPersistStreamInitImpl,
// and ISpecifyPropertyPageImpl to utilize the information in you property
// map.
//
// NOTE: The BCB Wizard does *NOT* maintain your PROPERTY_MAP table. You must
//    add or remove entries manually.
//
BEGIN_PROPERTY_MAP(TSignActiveFormXImpl)
  // PROP_PAGE(CLSID_SignActiveFormXPage)
END_PROPERTY_MAP()
/* DECLARE_VCL_CONTROL_PERSISTENCE(CppClass, VclClass) is needed for VCL
* controls to persist via the VCL streaming mechanism and not the ATL mechanism.
* The macro adds static IPersistStreamInit_Load and IPersistStreamInit_Save
* methods to your implementation class, overriding the methods in IPersistStreamImpl.
* This macro must be manually undefined or removed if you port to C++Builder 4.0. */
DECLARE_VCL_CONTROL_PERSISTENCE(TSignActiveFormXImpl, TSignActiveFormX);
// The DECLARE_ACTIVEXCONTROL_REGISTRY macro declares a static ''UpdateRegistry''
// routine which registers the basic information about your control. The
// parameters expected by the macro are the ProgId & the ToolboxBitmap ID of
/

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号