vbscript/javascript和COM的数据传递

我们经常会遇到,将脚本中定义的多个参数打包到一个数组中,然后将这个数组传给一个组件方法。javascriptvbscript定义数组的方式是不 同的。vbscript中的数组采用的是自动化兼容类型SAFEARRAY,对它进行遍历是很方便的。而javascript动态脚本的秘密武器--是IDispatchEx接口
   
对于一个基本的Object对象,即可以动态的增加或删除属性、方法,也可以生成一个自定义的类,完全基于一个IDispatchEx接口。 IDispatchExIDispatch的扩展,为实现动态脚本的一些动态特性量身定制。除了提供IDispatch接口的所有方法之 外,IDispatchEx还额外提供以下几个特性:

    • Add new members to an object ("expando") — use GetDispID with the fdexNameEnsure flag.

    • Delete members of an object — use DeleteMemberByName or DeleteMemberByDispID.

    • Case-sensitive dispatch operations — use fdexNameCaseSensitive or fdexNameCaseInsensitive.

    • Search for member with implicit name — use fdexNameImplicit.

    • Enumerate DISPIDs of an object — use GetNextDispID.

    • Map from DISPID to element name — use GetMemberName.

    • Obtain properties of object members — use GetMemberProperties.

    • Method invocation with this pointer — use InvokeEx with DISPATCH_METHOD.

Allow browsers that support the concept of name spaces to obtain the name space parent of an object — use GetNameSpaceParent. ,

ActiveX组件与JavaScript交互
http://hi.baidu.com/huhe/blog/item/817a59ee1ca423f8b3fb95de.html
介绍了连接点, 数据传递,等

而对于vb的safearray, 推荐使用atl的CComSafeArray<>和CComVariant<>类
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值