"There is no difficulty in the world, as long as Ken Denzhang", so you have to be confident to become a COM programmer, and you will be able to.
In fact, each time we set the text properties of the text program control, it is already using COM, and when you run the MoveNext method in the DAO data control, it is also used when using the VB control word.
So what is CoM?
First, COM is a way of communication.
For example, just like our TV remote control. When we press a channel button, the TV channel immediately switches; and when we press the switch button, the TV is turned off immediately. In fact, we don't care how they work, we only know that the button can generate an action.
The principle of the program is also the same. When we change the text properties of the text programming control, we don't know the principles, maybe the system will call dozens of API functions inside the system. But for the user, only the text displayed in the text program control is also concerned.
Second, COM is a way of reused code.
The maximum benefit of using COM is that once the COM is established, it can be convenient to use multiple times anywhere. For example, when the user creates a COM component for displaying the date and time, it can be used anywhere in any program. Not only VB applications, the Excel program can access, but also C applications can also access it.
Therefore, the code reusability of COM components is the most important.
Again, COM is based on the actual object.
Most components created with COM are based on actual objects, which means that once the component is created, it is quite easy. Imagine if we add a user in the computer system, which is added such as Customer.Add, is it simple to add a data processing code package, algorithm, or add a larger database DLL to the application? Obviously, COM supports this simple operation.
Therefore, COM is a communication method, a code reuse method, and based on the actual object.
The relevant content of COM and VB will be simply discussed in the later part of this tutorial, which includes creation of classes, and how to convert classes into an actual object. Although the content here is too simple, it is the foundation of COM programming later.