What is ActiveX development knowledge?

Source: Internet
Author: User

Because we have to create an electronic map + Video Monitoring System for a project some time ago, taking into account the company's existing development resource C # Project Team) and the completed lower-level business framework C ++ implementation ), selected. net technology combined with ActiveX to achieve the demand. I wrote the lower-layer business framework, so I started my own compilation of Activex plug-ins.

According to my habits, I don't rush to get started with a new technology. Instead, I started to understand the basic principles. So I learned some background about ActiveX and use cases through various encyclopedias. Go deep into the COM technology behind it and read Pan aimin's "COM Essence Theory" to understand the ideas behind Activex. As a result, after clarifying the basic context of ActiveX, the compilation of business plug-ins started.

The most basic usage of ActiveX plug-ins: Method interface and event Interface

The method interface is called --> wait for the result to return. However, a synchronous method interface combined with js's single-threaded feature has a fatal flaw in the interface experience. When the interface returns, the whole interface will be frozen and cannot respond to any action.

Although the Asynchronous Method interface can return results immediately, how can it obtain the final result? The event interface can solve this problem. We can register the event at the front-end, and then respond to the event in the ActiveX background, so that the front-end can obtain the correct result, similar to callback functions we are familiar. I recommend Ruan Yifeng's article "four methods of Javascript asynchronous programming" to understand the two situations I mentioned above.

Is that simple? However, it seems that this is not the case. To write an interface as an asynchronous interface, you must open a thread inside the interface to execute the operation that takes a long time, then, after the operation is complete, respond to the Event Notification upper layer to obtain data. There is a pitfall here. If you respond to the event interface in the started thread, the foreground will not be able to respond. What should we do? The solution here is How to start a second thread in an MFC-based ActiveX control to fire events in Visual C ++.

Memorandum

"Love to forget this human nature" is definitely a killer of our programmers, not to mention anything else, affecting work efficiency! I wrote several method interfaces and event interfaces a month ago, and I forgot the IDE shortcut when I wrote them again due to demand changes yesterday. I asked google for help, so I have to create a memorandum for several points.

  • Memorandum 1: how to add methods and event interfaces to the Project

    Here, add the method:

    650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131229/1241425342-0.jpg "title =" 1a.jpg "alt =" 211951938.jpg"/>

    Add events here:

    650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131229/1241423103-1.jpg "title =" 2a.jpg "alt =" 212042406.jpg"/>

    Note: If you are prompted that the event interface cannot be found, manually add it to the corresponding location)

  • Memorandum 2: two major tools for testing and debugging ActiveX plug-ins

    TstCon32.exe, Microsoft ActiveX Control Pad;

  • Memo 3: js script call method, sample code of the event

The issues can be explained.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131229/1241422612-2.jpg "title =" 3a.jpg "alt =" 212129775.jpg"/>


In addition, there are some ActiveX space signature packaging knowledge, many front-end articles have been introduced, and I will not be so ugly.


This article from "forever friends" blog, please be sure to keep this source http://yaocoder.blog.51cto.com/2668309/1325664

Related Article

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.