package.html 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <HTML>
  2. <HEAD>
  3. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
  4. <META NAME="Generator" CONTENT="Microsoft Word 97">
  5. <TITLE>The win32com package</TITLE>
  6. <META NAME="Template" CONTENT="D:\Program Files\Microsoft Office\Office\html.dot">
  7. </HEAD>
  8. <BODY LINK="#0000ff" VLINK="#800080">
  9. <H1><IMG SRC="image/pycom_blowing.gif" WIDTH=549 HEIGHT=99 ALT="Python and COM - Blowing the others away"></H1>
  10. <H1>The win32com package </H1>
  11. <FONT SIZE=2><P>This document describes the win32com package in general terms.</FONT> </P>
  12. <FONT SIZE=2><P>The COM support can be thought of as existing in 2 main portions - the C++ support code (the core PythonCOM module), and helper code, implemented in Python. The total package is known as "win32com".</FONT> </P>
  13. <FONT SIZE=2><P>The win32com support is stand-alone. It does not require Pythonwin.</FONT> </P>
  14. <H2>The win32com package </H2>
  15. <FONT SIZE=2><P>To facilitate an orderly framework, the Python "ni" module has been used, and the entire package is known as "win32com". As is normal for such packages, win32com itself does not provide any functionality. Some of the modules are described below:</FONT> </P>
  16. <UL>
  17. <B><FONT SIZE=2><LI>win32com.pythoncom - core C++ support</B>. <BR>
  18. This module is rarely used directly by programmers - instead the other "helper" module are used, which themselves draw on the core pythoncom services.</FONT> </LI>
  19. <B><FONT SIZE=2><LI>win32com.client package<BR>
  20. </B>Support for COM clients used by Python. Some of the modules in this package allow for dynamic usage of COM clients, a module for generating .py files for certain COM servers, etc.</FONT> </LI>
  21. <B><FONT SIZE=2><LI>win32com.server package<BR>
  22. </B>Support for COM servers written in Python. The modules in this package provide most of the underlying framework for magically turning Python classes into COM servers, exposing the correct public methods, registering your server in the registry, etc. </LI>
  23. <B><LI>win32com.axscript<BR>
  24. </B>ActiveX Scripting implementation for Python.</FONT> </LI>
  25. <B><FONT SIZE=2><LI>win32com.axdebug<BR>
  26. </B>Active Debugging implementation for Python</FONT> </LI>
  27. <B><FONT SIZE=2><LI>win32com.mapi<BR>
  28. </B>Utilities for working with MAPI and the Microsoft Exchange Server</LI></UL>
  29. </FONT><P>&nbsp;</P>
  30. <H2>The pythoncom module </H2>
  31. <FONT SIZE=2><P>The pythoncom module is the underlying C++ support for all COM related objects. In general, Python programmers will not use this module directly, but use win32com helper classes and functions. </P>
  32. <P>This module exposes a C++ like interface to COM - there are objects implemented in pythoncom that have methods "QueryInterface()", "Invoke()", just like the C++ API. If you are using COM in C++, you would not call a method directly, you would use pObject-&gt;Invoke( …, MethodId, argArray…). Similarly, if you are using pythoncom directly, you must also use the Invoke method to call an object's exposed method.</FONT> </P>
  33. <FONT SIZE=2><P>There are some Python wrappers for hiding this raw interface, meaning you should almost never need to use the pythoncom module directly. These helpers translate a "natural" looking interface (eg, obj.SomeMethod()) into the underlying Invoke call.</P></FONT></BODY>
  34. </HTML>