![]() ![]() An interface is defined in terms of a C++ vtable. Each COM interface has a unique 128-bit GUID known as an interface ID (IID).Īn interface defines a series of methods: interfaces can't have properties. This is a huge advantage to users of these interfaces, because you can code to the IStream interface, and your code works regardless of whether your data goes to a file or out over a socket. Although COM defines the IStream interface, it's the responsibility of objects to implement the interface thus, you may have an object that implements the IStream interface writing to and from files or an object implementing the IStream interface using sockets, and so forth. For example, COM defines an IStream interface, a generic interface for reading and writing, in a manner similar ![]() An interface describes how an object is to behave, while the object itself implements the behavior. An interface describes certain functionality, while an object implements that functionality (that is, implements the interface). If you want to see how to use Python to control COM objects such as Microsoft Word or Excel you can jump directly to the section ''Using Automation Objects from Python.'' Interfaces and ObjectsĬOM makes a clear distinction between interfaces and objects. Although Python hides many of the implementation details, understanding these details makes working with Python and COM much easier. In order to fully understand Python and COM, it is necessary to understand COM itself. We then look at using COM objects from Python in more detail and finish with an in-depth discussion of implementing COM objects using Python. We initially provide a discussion of COM itself and how it works an understanding of which is necessary if you need to use advanced features of COM from Python. In this chapter we take a more technical look at COM and using Python from COM. If you have never used Python and COM together or are unfamiliar with basic COM concepts, you should review that chapter before continuing here. In Chapter 5, Introduction to COM, we presented some basic material about Python and COM. Python Programming on Win32: Chapter 12 - Advanced Python and COM ![]()
0 Comments
Leave a Reply. |