"COM Technology Insider" FAQ

Source: Internet
Author: User
Tags object model ole

Reading questions One: "Automation replaces compiler-generated code in many different ways with the code that developers write ..." How do I understand this sentence? (11th chapter, distribution interface and automation, P231)

A: This sentence to the effect that: we originally wrote the application, are the source level, need to compile the compiler, in order to execute, now, scripting language to operate the Automation interface, you can dynamically complete the same application (in fact, the interpretation of the implementation).

A simple example, you definitely do not have Word source code, if you want to use Word to generate a specific application areas (such as government official documents) application, you can only find the source of the company to modify the source code to meet your special needs. (Microsoft listens to you?) )

However, you can use the Automation interface to customize your specific application, using VBA scripts to control Word's automation interface can be completed. Yes, explain the implementation is slow, but, for you do not need to change the source code, do not have to test your modified source code section, is not better?

Reading question two: "If C + + programmers want to build a vtbl from scratch at run time, then he can completely decide how to construct it." On the other hand ... " How should this passage be understood? (11th chapter, distribution interface and automation, P234)

A: Yes, a vtble build is done for you by the compiler you use, but if you understand the VTBL construction process, you can copy one out. Suggested reading: "com essence" + "Inside C + + Object Model", to have a good psychological preparation, chew the tough.

Reading question three: OleInitialize and CoInitialize (Ex) What is the difference between these two functions?

P236 The sixth line has a call to OleInitialize.

A: CoInitialize and CoInitializeEx are used to initialize the COM operating environment, like martial arts people in the martial arts before the first draw a circle, in the circle put weapons.

OleInitialize is the operating environment where OLE is initialized, and OLE is an extension of COM based on the ActiveX operation. It was like a wire that was propped up in the circle, to perform like a wire.

Reading question four: P208 page, about the Point_default keyword explanation, can not understand:

1. The role of the Point_default keyword is to tell the MIDL compiler what to do with this pointer when no other attributes are specified for the pointer. What are the "other properties"?

2, "Within the function, you can not specify aliases ...", what is an alias?

A: As for the alias, refers to the MIDL language in the TypeDef bar (I am sorry, I do not have much attention to the scheduling of COM, only a simple answer, please have a clear answer after you tell me).

Reading question five: P234 last sentence, "Of course, using COM interface to implement IDispatch::Invoke is also possible, see figure 11-2"

1, with COM interface How to implement invoke?

2, Figure 11-2 Foobar is not a COM interface bar (no IUnknown that three functions)?

A: COM is better c++,com implementation in fact borrowed a lot of C + + implementation way, for example, using what I said earlier VTBL,

As a rule, I don't think we should refer to the foobar of Figure 11-2 as a COM interface, but in a broad sense, because of the use of VTBL, we can barely think of him as a COM interface, (if the author has to say ^_^)

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.