Interaction between JavaScript and ActiveX

Source: Internet
Author: User
Document directory
  • Add-2011-8-5
Data Exchange
Javascript data types are not rich in C ++. The best way is to pass data through strings, package and parse the data according to the Conventions. If JavaScript transmits data to ActiveX without Chinese characters, you can directly use char *. The engineering attribute is multi-byte encoding. If ActiveX transmits a string to Javascript, the width character is required...
Mutual call of methods
Javascript calls ActiveX functions most directly. A global ActiveX object is defined in the HTML webpage. js directly uses the Object ID to operate controls. Call a member function by using the external name of the function in ActiveX. The external name of the function is defined as the second string of the disp_function_id macro In the CTRL file. For general interface functions, use disp_function_id.

Ativex calls JS functions, which is somewhat similar to the QT semaphore mechanism. First, declare the event ing in ActiveX. The event function is only a fireevent. In ActiveX, you can call this event function at will. JS implements this function (also using the external name of the event function) to define the behavior of this function. Then, when ActiveX calls this function, it actually calls the JS function. The event function uses the event_custom_id macro.

Data exchange between JS and ActiveX is implemented through mutual calls.

Code download: http://download.csdn.net/source/3476200

Add-2011-8-5
ActiveX controls are the same as DLL controls. When multiple controls are defined in an HTML webpage, their IDs are the same. These controls share the global variables and global callback functions in the program.. The last modification to global variables takes effect...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.