ActiveX component review notes .1

xiaoxiao2021-03-06  19

Just studying VB6 advanced programming, the understanding of the three-story architecture, class, ActiveX components, etc.

This semester graduation design is developed with VB6 SQL Server2000, which needs to be used in the previous knowledge.

It is an urgent task to understand the knowledge you have learned! I hope that by reviewing, I can have a deeper understanding of VB with this graduation design (although my interest is also web development)!

In addition, a few days later, I saw a three-story architecture article , recommended to learn three-layer architecture like me!

=================================================================================================================================================================================

Ok, let's finish, and finally declare. The following review notes are selected from the One book

Which type of component should I establish?

How to decide which type of component is best for you for all optional different types of ActiveX components? Considering this issue from the perspective of the function, you may give you help:

1. If the components that need to provide services are not visible, create a code component - or ActiveX EXE, or ActiveX DLL.

2. If the required components can run in the same process with your application, you should create an ActiveX DLL. For example, the components that can perform complex calculations belong to this situation.

3. If the components you need can serve multiple applications, and you should create an ActiveX EXE to be created on the remote computer. For example, a business rules server end that performs tax rules, it is best to be implemented as an ActiveX EXE.

4. If you need a visible part and can be dragged and dropped into an application during design, the ActiveX control should be created. For example, a Phone Number control that is able to correctly format and verify the phone number, it belongs to this situation. Such controls are undoubtedly useful in many applications.

5. If you need a visible part and you can take over the application's window, you should select the ActiveX document. The above example shows a "sales" application that can be browsed in the web browser, which repeats the functionality of the desktop application.

Regardless of which type of ActiveX part is selected, Visual Basic guarantees their reusability

=================================================================================================================================================================================

Do not confuse the parts software development and object-oriented programming (OOP) using ActiveX technology. Object-based software components can be established using the OOP method; use ActiveX technology to combine created object-based components, and these components can be created through many different tools. In exchange, OOP is concerned about creating an object, and ActiveX is concerned about working with an object.

=================================================================================================================================================================】 Constant and events, create a perfect ActiveX control package will become easy.

You can put it in the process of the ActiveX document package, or you can pack it into processes.

You can use code components to provide standard libraries for mode and non-Mode dialogs - although neither code parts are free.

=================================================================================================================================================================================

ActiveX DLL runs in the process of another application. It can be an application itself or a component within the other processes that the application is being used.

The error in the Class_terminate event process is required. Using components cannot handle errors in class_terminate, these errors will be fatal for applications.

In contrast, an error not processed in the initialize event is that occurs when the application creates the object, so it can be processed by the application.

Initialize and Terminate events will never be deal with users.

Press the F2 key to open the Object Browser.

When the ActiveX part accepted the first object requesting the object provided, it was to execute its Sub Main process, which before the component creates an object. The Sub Main process should be as short as possible because the execution time of the Sub Main may result in a request timeout for the creation of an object.

Click the Test button in the upper right corner of the form to perform the Terminate event of any object. To remember, if you end with the End button or through the end statement in the code, the program will immediately abort and do not perform the Terminate event of any object. In general, it is a better way to close the program by uninstalling all forms.

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

New Post(0)