COM programming (ii) briefly summarize how to call the COM interface

Source: Internet
Author: User

Through the previous study and practice, we have learned how com is and how to call COM components.

To sum up, COM is the component object model, which means that the COM Object and COM class are different from the objects and classes in C ++, VB, or Delphi, COM Object and COM class are independentProgramming LanguageAnd has a set of memory layout specifications, so Binary-level Functional Reuse can be achieved. The purpose of COM is to reuse modules across programming languages and development platforms. (Although currently. the net platform solves the reuse of modules between different programming languages, such as VB.net and C #. net, but the reuse is based on Microsoft intermediate language, not localCodeLevel. NET Framework is actually a runtime)

The previous call to the Windows Shell Interface shows how the client calls the COM Service. It can be seen that the interface provided by Windows shell is the standard COM interface, which can be easily used for shell programming, shell programming is interesting. You can customize the operating system through the interface provided by the operating system, but there are not many official shell interfaces provided by the Windows operating system platform.

1. First, use the coinitialize function to initialize the com environment, return hresutl, and use succeded or failed macro to check whether the initialization is successful.
2. Use the cocreateinstance function to create a component object you want and assign an interface to you.
3. Use this interface to perform operations. If you want to use other interfaces, you can use QueryInterface to query other interfaces.
4 uninitialize () uninstall the com Environment

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.