vbscript/javascript和COM的資料傳遞

來源:互聯網
上載者:User

我們經常會遇到,將指令碼中定義的多個參數打包到一個數組中,然後將這個數組傳給一個組件方法。javascript和vbscript定義數組的方式是不 同的。vbscript中的數組採用的是自動化相容類型SAFEARRAY,對它進行遍曆是很方便的。而javascript動態指令碼的秘密武器--是IDispatchEx介面
    對於一個基本的Object對象,即可以動態增加或刪除屬性、方法,也可以產生一個自訂的類,完全基於一個IDispatchEx介面。 IDispatchEx是IDispatch的擴充,為實現動態指令碼的一些動態特性量身定製。除了提供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<>類

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.