• 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<>类
  • 相关阅读:
    error C2440: 'initializing' : cannot convert from 'const char [11]' to 'ATL::CStringT<BaseType,Strin
    DB1:数据库的创建和文件的修改
    Django之Form表单
    Django内置的分页模块
    Cookie和Session
    AJAX使用说明书 基础
    JSON和Django内置序列化
    django之urls系统
    Django之views系统
    模板语言
  • 原文地址:https://www.cnblogs.com/cutepig/p/1546684.html
Copyright © 2020-2023  润新知