|
def GetModule(tlib): |
|
"""Create a module wrapping a COM typelibrary on demand. |
|
|
|
'tlib' must be an ITypeLib COM pointer instance, the pathname of a |
|
type library, a COM CLSID GUID, or a tuple/list specifying the |
|
arguments to a comtypes.typeinfo.LoadRegTypeLib call: |
|
|
|
(libid, wMajorVerNum, wMinorVerNum, lcid=0) |
|
|
|
Or it can be an object with _reg_libid_ and _reg_version_ |
|
attributes. |
|
|
|
A relative pathname is interpreted as relative to the callers |
|
__file__, if this exists. |
|
|
|
This function determines the module name from the typelib |
|
attributes, then tries to import it. If that fails because the |
|
module doesn't exist, the module is generated into the |
|
comtypes.gen package. |
|
|
|
It is possible to delete the whole `comtypes/gen` directory to |
|
remove all generated modules, the directory and the __init__.py |
|
file in it will be recreated when needed. |
|
|
|
If comtypes.gen __path__ is not a directory (in a frozen |
|
executable it lives in a zip archive), generated modules are only |
|
created in memory without writing them to the file system. |
|
|
|
Example: |
|
|
|
GetModule("shdocvw.dll") |
|
|
|
would create modules named |
|
|
|
comtypes.gen._EAB22AC0_30C1_11CF_A7EB_0000C05BAE0B_0_1_1 |
|
comtypes.gen.SHDocVw |
|
|
|
containing the Python wrapper code for the type library used by |
|
Internet Explorer. The former module contains all the code, the |
|
latter is a short stub loading the former. |
|
""" |
Internet Explorer is end of support.
https://blogs.windows.com/windowsexperience/2022/06/15/internet-explorer-11-has-retired-and-is-officially-out-of-support-what-you-need-to-know/
https://blogs.windows.com/windowsexperience/2021/05/19/the-future-of-internet-explorer-on-windows-10-is-in-microsoft-edge/
But the docstring of
client.GetModulestill contains examples about IE.comtypes/comtypes/client/_generate.py
Lines 79 to 119 in b35a0ff