Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GeneratedSupport.html 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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>Generated Python COM Support</TITLE>
  6. <META NAME="Version" CONTENT="8.0.3410">
  7. <META NAME="Date" CONTENT="10/11/96">
  8. <META NAME="Template" CONTENT="D:\Program Files\Microsoft Office\Office\html.dot">
  9. </HEAD>
  10. <BODY TEXT="#000000" LINK="#0000ff" VLINK="#800080" BGCOLOR="#ffffff">
  11. <P><IMG SRC="image/pycom_blowing.gif" WIDTH=549 HEIGHT=99 ALT="Python and COM - Blowing the others away"></P>
  12. <H1>Generated Python COM Support</H1>
  13. <P>This file describes how the Python COM extensions support "generated files". The information contained here is for expert Python users, and people who need to take advantage of the advanced features of the support. More general information is available in the <A HREF="QuickStartClientCom.html">Quick Start to Client Side COM</A> documentation.</P>
  14. <H2>Introduction</H2>
  15. <P>Generated Python COM support means that a .py file exists behind a particular COM object. This .py file is created by a generation process from a COM type library.</P>
  16. <P>This documentation talks about the process of the creation of the .py files.</P>
  17. <H2>Design Goals</H2>
  18. <P>The main design goal is that the Python programmer need not know much about the type library they wish to work with. They need not know the name of a specific Python module to use a type library. COM uses an IID, version and LCID to identify a type library. Therefore, the Python programmer only need know this information to obtain a Python module.</P>
  19. <H2>How to generate support files</H2>
  20. <P>Support files can be generated either "off-line" by the makepy utility, or in custom Python code.</P>
  21. <P>Using makepy is in many ways far simpler - you simply pick the type library and you are ready to go! The <A HREF="QuickStartClientCom.html">Quick Start to Client Side COM</A> documentation describes this process.</P>
  22. <P>Often however, you will want to use code to ensure the type library has been processed. This document describes that process.</P>
  23. <H2>Usage</H2>
  24. <P>The win32com.client.gencache module implements all functionality. As described above, if you wish to generate support from code, you need to know the IID, version and LCID of the type library.</P>
  25. <P>The following functions are defined. The best examples of their usage is probably in the Pythonwin OCX Demos, and the COM Test Suite (particularly testMSOffice.py)</P>
  26. <P>Note that the gencache.py file supports being run from the command line, and provides some utilities for managing the cache. Run the file to see usage options.</P>
  27. <H2>Using makepy to help with the runtime generation</H2>
  28. <P>makepy supports a "-i" option, to print information about a type library. When you select a type library, makepy will print out 2 lines of code that you cant paste into your application. This will then allow your module to generate the makepy .py file at runtime, but will only take you a few seconds!</P>
  29. <H2>win32com.client.gencache functions</H2>
  30. <H3>def MakeModuleForTypelib(typelibCLSID, lcid, major, minor, progressInstance = None):</H3>
  31. <P>Generate support for a type library.</P>
  32. <P>Given the IID, LCID and version information for a type library, generate and import the necessary support files.</P>
  33. <B><P>Returns</P>
  34. </B><P>The Python module. No exceptions are caught.</P>
  35. <B><P>Params</P>
  36. </B><I><P>typelibCLSID</I><BR>
  37. IID of the type library.</P>
  38. <I><P>major</I><BR>
  39. Integer major version.</P>
  40. <I><P>minor</I><BR>
  41. Integer minor version.</P>
  42. <I><P>lcid</I><BR>
  43. Integer LCID for the library.</P>
  44. <I><P>progressInstance</I><BR>
  45. A class instance to use as the progress indicator, or None to use the default GUI one.&nbsp;</P>
  46. <H3>def EnsureModule(typelibCLSID, lcid, major, minor, progressInstance = None):</H3>
  47. <P>Ensure Python support is loaded for a type library, generating if necessary.</P>
  48. <P>Given the IID, LCID and version information for a type library, check and if necessary generate, then import the necessary support files.</P>
  49. <P>Returns:</P>
  50. <P>The Python module. No exceptions are caught during the generate process.</P>
  51. <B><P>Params</P>
  52. </B><I><P>typelibCLSID</I><BR>
  53. IID of the type library.</P>
  54. <I><P>major</I><BR>
  55. Integer major version.</P>
  56. <I><P>minor</I><BR>
  57. Integer minor version.</P>
  58. <I><P>lcid</I><BR>
  59. Integer LCID for the library.</P>
  60. <I><P>progressInstance</I><BR>
  61. A class instance to use as the progress indicator, or None to use the default GUI one.&nbsp;</P>
  62. <P>&nbsp;</P>
  63. <H3>def GetClassForProgID(<I>progid</I>):</H3>
  64. <P>Get a Python class for a Program ID</P>
  65. <P>Given a Program ID, return a Python class which wraps the COM object</P>
  66. <B><P>Returns</P>
  67. </B><P>The Python class, or None if no module is available.</P>
  68. <B><P>Params</P>
  69. </B><I><P>progid<BR>
  70. </I>A COM ProgramID or IID (eg, "Word.Application")</P>
  71. <P>&nbsp;</P>
  72. <H3>def GetModuleForProgID(progid):</H3>
  73. <P>Get a Python module for a Program ID</P>
  74. <P>Given a Program ID, return a Python module which contains the class which wraps the COM object.</P>
  75. <B><P>Returns</P>
  76. </B><P>The Python module, or None if no module is available.</P>
  77. <B><P>Params:</P>
  78. </B><I><P>progid <BR>
  79. </I>A COM ProgramID or IID (eg, "Word.Application")</P>
  80. <P>&nbsp;</P>
  81. <H3>def GetModuleForCLSID(clsid):</H3>
  82. <P>Get a Python module for a CLSID</P>
  83. <P>Given a CLSID, return a Python module which contains the class which wraps the COM object.</P>
  84. <B><P>Returns</P>
  85. </B><P>The Python module, or None if no module is available.</P>
  86. <B><P>Params</P>
  87. </B><I><P>progid<BR>
  88. </I>A COM CLSID (ie, not the description)</P>
  89. <P>&nbsp;</P>
  90. <H3>def GetModuleForTypelib(typelibCLSID, lcid, major, minor):</H3>
  91. <P>Get a Python module for a type library ID</P>
  92. <B><P>Returns</P>
  93. </B><P>An imported Python module, else None</P>
  94. <B><P>Params</B>:</P>
  95. <I><P>typelibCLSID</I><BR>
  96. IID of the type library.</P>
  97. <I><P>major</I><BR>
  98. Integer major version.</P>
  99. <I><P>minor</I><BR>
  100. Integer minor version</P>
  101. <I><P>lcid</I><BR>
  102. Integer LCID for the library.</P></BODY>
  103. </HTML>