Create an ActiveX EXE component

xiaoxiao2021-03-06  29

December 7, 2004 23:55:46

0. The component provides reusable code in an object manner. By creating an object and calling its properties and methods to use the application of the component's code,

Customers, relative to clients using component objects, components can run outside the process or processes. Process outer or ActiveX EXE runs in its own address space. The client is usually an application running in other processes.

1. Process external components run in their own process, which means that the client can notify the part to do something, then the client can continue its work when the part is working. When such a system is established correctly, the component can use at the end of the task.

Asynchronous notifications to notify the client, this explains in "establishing code components" "asynchronous callback and event".

2. An enumerated enumeration type that is declared into public in the class module is added to the type library of components. It doesn't contact the class defined in it, but it will become part of the global namespace. (Foshan 83272853)

3. Why do you have your constant when Visual Basic contains VBModal and VBModeless? These components may be used with development tools that do not provide these constants. Providing constants with Visual Basic is a flexible solution.

4. The relationship between the process outer part displayed with the mode displayed by the internal parts and the non-mode form is different from the form of the form of the client application. First, the form displayed by the process outside the process does not depend on the customer application. Its life does not depend on the customer's life. Second, the loaded form can prevent the executable of the process outside the process from being unloaded.

5. Once the ActiveX EXE project is placed in the running state, it keeps the state. This is very convenient for testing, but its operation is different from doing .exe files. When the final customer releases the final reference to the object provided by the component, the executable program of the process outside the process is uninstalled, so the proximity code part is generally not the best way to display the form.

6. Providing asynchronous notifications for customers is one of the most interesting purposes, that is, when the component performs a method, the customer does not keep an obstruction state, when the component performs a task or waiting for something, customers continue to do their own Transaction. The notice of the component suddenly came to the customer, there is no special action in the customer.

7. Use the objects of the form in the process outside the process, and release them after these forms are used out.

8. One of the benefits of providing notifications is only one reference. That is, Testform does not need to reference the CoffeeMonitor object to send the Timer control to the CoffeeMonitor. This avoids the circulatory references described in the "General Criteria for Partial Design".

9. Of course, serious programmers want to ensure that coffee notice is obtained, regardless of what application is being used. You can create a separate CoffeeMonitor object for a program that you want to get notified, but if your computer doesn't have so many sketches, you can't do it.

10. As the object should release all the forms it created, they should release all objects it use. Because the reference to the global CoffeeMonitor is in the global variable, the last connector object must be released.

11. When all customers release the reference to the object, the compiled process exterior is closed unless it has a loaded form. At compile time, Testform has been running the Coffee component, while CoffeeMonitor maintains reference to Testform. Because the CoffeeMonitor object uses global variables to make itself not terminated, the part will not be closed. 12. Another technology that notifies the customer is an asynchronous callback method that will discuss this method in the "asynchronous notice using the callback method". The callback implementation is more difficult, but it allows the part to receive the return value and error generated by the client, and performance is also slightly better.

13. Code components without user interfaces can be referred to as unmanned monitoring, which is not interacting with users. For process external components, this option can also multi-thread.

summary:

When you create a new ActiveX EXE component, the following steps are generally applied: 1. Decide that the components to be provided. 2. On logically, the functionality of the part is partially divided to several objects. 3. All forms of design parts to be displayed. 4. The design interface is also the properties, methods, and events of the various classes provided by the components. 5. Creating an independent test project, usually a Standard Exe project. 6. Implement the form used by the component. 7. Implement the interfaces of each class. 8. When each interface element or feature is added, the performance is added to the test engineering to test new features. 9. Compile EXE and test with all potential target applications.

转载请注明原文地址:https://www.9cbs.com/read-83422.html

New Post(0)