comtypes 1.4.6__zip → 1.4.7__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {comtypes-1.4.6 → comtypes-1.4.7}/CHANGES.txt +18 -0
- {comtypes-1.4.6/comtypes.egg-info → comtypes-1.4.7}/PKG-INFO +28 -36
- {comtypes-1.4.6 → comtypes-1.4.7}/README.md +26 -34
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/__init__.py +1 -1
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/_post_coinit/bstr.py +13 -6
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/automation.py +9 -15
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/hints.pyi +2 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/persist.py +19 -3
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/shelllink.py +72 -21
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_client.py +9 -0
- comtypes-1.4.7/comtypes/test/test_monikers.py +70 -0
- comtypes-1.4.7/comtypes/test/test_persist.py +40 -0
- comtypes-1.4.7/comtypes/test/test_shelllink.py +133 -0
- comtypes-1.4.7/comtypes/test/test_storage.py +127 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/typeinfo.py +25 -22
- {comtypes-1.4.6 → comtypes-1.4.7/comtypes.egg-info}/PKG-INFO +28 -36
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes.egg-info/SOURCES.txt +5 -1
- {comtypes-1.4.6 → comtypes-1.4.7}/setup.cfg +1 -1
- {comtypes-1.4.6 → comtypes-1.4.7}/LICENSE.txt +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/MANIFEST.in +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/GUID.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/_comobject.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/_idl_stuff.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/_memberspec.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/_meta.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/_npsupport.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/_post_coinit/__init__.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/_post_coinit/misc.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/_post_coinit/unknwn.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/_py_instance_method.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/_safearray.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/_tlib_version_checker.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/clear_cache.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/client/__init__.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/client/_code_cache.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/client/_constants.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/client/_events.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/client/_generate.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/client/dynamic.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/client/lazybind.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/connectionpoints.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/errorinfo.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/git.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/hresult.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/logutil.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/messageloop.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/patcher.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/safearray.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/server/__init__.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/server/automation.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/server/connectionpoints.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/server/inprocserver.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/server/localserver.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/server/register.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/server/w_getopt.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/stream.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/TestComServer.idl +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/TestComServer.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/TestComServer.tlb +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/TestDispServer.idl +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/TestDispServer.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/TestDispServer.tlb +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/__init__.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/find_memleak.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/mylib.idl +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/mylib.tlb +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/mytypelib.idl +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/runtests.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/setup.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_BSTR.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_DISPPARAMS.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_GUID.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_QueryService.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_agilent.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_avmc.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_basic.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_casesensitivity.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_clear_cache.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_client_dynamic.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_client_regenerate_modules.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_collections.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_comserver.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_createwrappers.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_dict.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_dispifc_records.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_dispifc_safearrays.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_dispinterface.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_dyndispatch.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_excel.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_findgendir.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_getactiveobj.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_ie.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_ienum.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_imfattributes.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_inout_args.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_jscript.js +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_midl_safearray_create.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_msscript.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_npsupport.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_outparam.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_propputref.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_pump_events.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_recordinfo.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_safearray.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_sapi.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_server.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_showevents.py +0 -0
- /comtypes-1.4.6/comtypes/test/test_istream.py → /comtypes-1.4.7/comtypes/test/test_stream.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_subinterface.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_typeannotator.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_typeinfo.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_urlhistory.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_variant.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_win32com_interop.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_wmi.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/test_word.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/test/urlhist.tlb +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/tools/__init__.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/tools/codegenerator/__init__.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/tools/codegenerator/codegenerator.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/tools/codegenerator/helpers.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/tools/codegenerator/modulenamer.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/tools/codegenerator/namespaces.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/tools/codegenerator/packing.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/tools/codegenerator/typeannotator.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/tools/tlbparser.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/tools/typedesc.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/tools/typedesc_base.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/util.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes/viewobject.py +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes.egg-info/dependency_links.txt +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes.egg-info/entry_points.txt +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/comtypes.egg-info/top_level.txt +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/pyproject.toml +0 -0
- {comtypes-1.4.6 → comtypes-1.4.7}/setup.py +0 -0
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
Comtypes CHANGELOG
|
|
2
2
|
==================
|
|
3
3
|
|
|
4
|
+
Release 1.4.7
|
|
5
|
+
--------------
|
|
6
|
+
* Improve ``_CArrayType`` alias import. By @junkmd.
|
|
7
|
+
* Rename ``_byref_type`` and ``_carg_obj`` to ``_CArgObject``. By @junkmd.
|
|
8
|
+
* Fix typos and make the wording more natural in ``README.md``. By @umarbutler.
|
|
9
|
+
* Modernize ``BSTR`` definition. By @junkmd.
|
|
10
|
+
* Modernize ``tagDEC`` definition. By @junkmd.
|
|
11
|
+
* Remove methods with mangling names in ``typeinfo``. By @junkmd.
|
|
12
|
+
* Rename ``test_istream`` to ``test_stream``. By @junkmd.
|
|
13
|
+
* Add ``test_msvidctl``. By @junkmd.
|
|
14
|
+
* Add ``test_storage``. By @junkmd.
|
|
15
|
+
* Add ``test_monikers``. By @junkmd.
|
|
16
|
+
* Add ``test_shelllink``. By @junkmd.
|
|
17
|
+
* Add ``test_persist``. By @junkmd.
|
|
18
|
+
* Modernize ``persist``. By @junkmd.
|
|
19
|
+
* Add type annotations to ``shelllink``. By @junkmd.
|
|
20
|
+
* Bump ``python_requires`` to ``>=3.8`` in ``setup.cfg``. By @junkmd.
|
|
21
|
+
|
|
4
22
|
Release 1.4.6
|
|
5
23
|
--------------
|
|
6
24
|
* Add tests and method annotations for ``IRecordInfo``. By @junkmd.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: comtypes
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.7
|
|
4
4
|
Summary: Pure Python COM package
|
|
5
5
|
Home-page: https://github.com/enthought/comtypes
|
|
6
6
|
Download-URL: https://github.com/enthought/comtypes/releases
|
|
@@ -13,7 +13,7 @@ Classifier: Operating System :: Microsoft :: Windows
|
|
|
13
13
|
Classifier: Programming Language :: Python
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
15
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
-
Requires-Python: >=3.
|
|
16
|
+
Requires-Python: >=3.8
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE.txt
|
|
19
19
|
|
|
@@ -24,47 +24,40 @@ License-File: LICENSE.txt
|
|
|
24
24
|
[](https://github.com/enthought/comtypes/stargazers) [](https://github.com/enthought/comtypes/network/members)
|
|
25
25
|
[](https://tidelift.com/subscription/pkg/pypi-comtypes?utm_source=pypi-comtypes&utm_medium=readme)
|
|
26
26
|
|
|
27
|
-
## About
|
|
28
27
|
|
|
29
|
-
`comtypes` is a lightweight
|
|
28
|
+
`comtypes` is a lightweight pure Python [COM](https://learn.microsoft.com/en-us/windows/win32/com/component-object-model--com--portal) package based on the [`ctypes`](https://docs.python.org/library/ctypes.html) foreign function interface library.
|
|
30
29
|
|
|
31
|
-
`comtypes` allows to define, call, and implement custom and dispatch-based COM interfaces in pure
|
|
30
|
+
`comtypes` allows you to define, call, and implement custom and dispatch-based COM interfaces in pure Python.
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
`comtypes` requires Windows and Python 3.8 or later.
|
|
33
|
+
- Version [1.4.6](https://pypi.org/project/comtypes/1.4.6/) is the last version to support Python 3.7.
|
|
34
|
+
- Version [1.2.1](https://pypi.org/project/comtypes/1.2.1/) is the last version to support Python 2.7 and 3.3–3.6.
|
|
35
|
+
- `comtypes` does not work with Python 3.8.1 as reported in [GH-202](https://github.com/enthought/comtypes/issues/202). This bug has been fixed in Python >= 3.8.2.
|
|
36
|
+
- Certain `comtypes` functions may not work correctly in Python 3.8 and 3.9 as reported in [GH-212](https://github.com/enthought/comtypes/issues/212). This bug has been fixed in Python >= 3.10.10 and >= 3.11.2.
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
- [`comtypes==1.2.1`](https://pypi.org/project/comtypes/1.2.1/) is the last version supporting `Python` 2.7 and 3.3-3.6.
|
|
37
|
-
- In `Python` 3.7.6 and 3.8.1, `comtypes` would not work as reported in [GH-202](https://github.com/enthought/comtypes/issues/202).
|
|
38
|
-
This bug has been fixed in `Python` >= 3.7.7 and >= 3.8.2.
|
|
39
|
-
- In `Python` 3.8 and 3.9, some of `comtypes` functionalities may not work correctly as reported in [GH-212](https://github.com/enthought/comtypes/issues/212).
|
|
40
|
-
This bug has been fixed in `Python` >= 3.10.10 and >= 3.11.2.
|
|
41
|
-
|
|
42
|
-
## Where to get it
|
|
43
|
-
|
|
44
|
-
The source code is currently hosted on GitHub at:
|
|
45
|
-
https://github.com/enthought/comtypes
|
|
46
|
-
|
|
47
|
-
An installer for the latest released version is available at the [Python Package Index (PyPI)](https://pypi.org/project/comtypes).
|
|
38
|
+
## Installation
|
|
48
39
|
|
|
40
|
+
`comtypes` is available on [PyPI](https://pypi.org/project/comtypes) and can be installed with `pip`:
|
|
49
41
|
```sh
|
|
50
42
|
# PyPI
|
|
51
43
|
pip install comtypes
|
|
52
44
|
```
|
|
53
45
|
|
|
54
|
-
|
|
46
|
+
The source code is currently hosted [here](https://github.com/enthought/comtypes) on GitHub.
|
|
47
|
+
|
|
48
|
+
### Dependencies
|
|
55
49
|
|
|
56
|
-
`comtypes`
|
|
50
|
+
`comtypes` is a pure Python package — it has no additional required dependencies.
|
|
57
51
|
|
|
58
|
-
Optional
|
|
59
|
-
- to process arrays as `numpy`'s `ndarray
|
|
60
|
-
-
|
|
52
|
+
Optional functionalities can be enabled by installing:
|
|
53
|
+
- `numpy`, in order to process arrays as `numpy`'s `ndarray`.
|
|
54
|
+
- `mypy` or other static type checkers, in order to interpret type hints.
|
|
61
55
|
|
|
62
|
-
|
|
56
|
+
None of these packages, however, are required in order to run `comtypes`.
|
|
63
57
|
|
|
64
|
-
## Community
|
|
58
|
+
## Community
|
|
65
59
|
|
|
66
|
-
|
|
67
|
-
https://github.com/enthought/comtypes
|
|
60
|
+
The [GitHub repository](https://github.com/enthought/comtypes) is used for tracking issues, reporting bugs, and contributing to the codebase and documentation.
|
|
68
61
|
|
|
69
62
|
## For Enterprise
|
|
70
63
|
|
|
@@ -77,17 +70,17 @@ This project and the maintainers of thousands of other packages are working with
|
|
|
77
70
|
## Frequently Asked Questions
|
|
78
71
|
|
|
79
72
|
### Q: Why does this package not support platforms other than Windows?
|
|
80
|
-
**A:**
|
|
73
|
+
**A:** The [Microsoft Component Object Model (COM)](https://learn.microsoft.com/en-us/windows/win32/com/com-technical-overview) is a technology that is unique to Windows and is not supported on other platforms.
|
|
81
74
|
|
|
82
75
|
[The phrase _"COM is a platform-independent"_ in the MS documentation](https://learn.microsoft.com/en-us/windows/win32/com/component-object-model--com--portal) means that COM maintains compatibility across different versions of Windows, and does NOT imply that it is supported on Linux or Mac.
|
|
83
76
|
|
|
84
|
-
|
|
77
|
+
For as long as COM is not supported outside of Windows, there is no plan to port `comtypes` to other platforms.
|
|
85
78
|
|
|
86
79
|
### Q: Why does `cannot import name 'COMError' from '_ctypes'` error occur when using this package on platforms other than Windows?
|
|
87
|
-
**A:** The [`_ctypes`](https://github.com/python/cpython/blob/main/Modules/_ctypes/_ctypes.c) is part of the internal implementation of the [`ctypes`](https://github.com/python/cpython/blob/main/Lib/ctypes/) standard library that exists for Python on all platforms.
|
|
88
|
-
However, `COMError` and COM-related features are implemented
|
|
80
|
+
**A:** The [`_ctypes`](https://github.com/python/cpython/blob/main/Modules/_ctypes/_ctypes.c) is part of the internal implementation of the [`ctypes`](https://github.com/python/cpython/blob/main/Lib/ctypes/) standard library that exists for Python on all platforms.
|
|
81
|
+
However, `COMError` and COM-related features are only implemented in Python for Windows.
|
|
89
82
|
|
|
90
|
-
In cross-platform software development, care must be taken to ensure that
|
|
83
|
+
In cross-platform software development, care must be taken to ensure that codebases that depend on `comtypes` do not execute in environments other than Windows.
|
|
91
84
|
|
|
92
85
|
### Q: Despite a script that depends on `comtypes` having run successfully before, a error (`ImportError`, `NameError`, or `SyntaxError`) is raised now, and the same error occurs again and again.
|
|
93
86
|
|
|
@@ -102,7 +95,6 @@ After deleting these partial modules and running the script again, `comtypes.cli
|
|
|
102
95
|
|
|
103
96
|
However, if the script implementation does not use `comtypes.client.GetModule` or processes generated files, it may not be a solution.
|
|
104
97
|
|
|
105
|
-
## Documentation
|
|
98
|
+
## Documentation
|
|
106
99
|
|
|
107
|
-
The documentation is currently hosted on
|
|
108
|
-
https://pythonhosted.org/comtypes
|
|
100
|
+
The documentation is currently hosted [here](https://pythonhosted.org/comtypes) on PythonHosted.
|
|
@@ -5,47 +5,40 @@
|
|
|
5
5
|
[](https://github.com/enthought/comtypes/stargazers) [](https://github.com/enthought/comtypes/network/members)
|
|
6
6
|
[](https://tidelift.com/subscription/pkg/pypi-comtypes?utm_source=pypi-comtypes&utm_medium=readme)
|
|
7
7
|
|
|
8
|
-
## About
|
|
9
8
|
|
|
10
|
-
`comtypes` is a lightweight
|
|
9
|
+
`comtypes` is a lightweight pure Python [COM](https://learn.microsoft.com/en-us/windows/win32/com/component-object-model--com--portal) package based on the [`ctypes`](https://docs.python.org/library/ctypes.html) foreign function interface library.
|
|
11
10
|
|
|
12
|
-
`comtypes` allows to define, call, and implement custom and dispatch-based COM interfaces in pure
|
|
11
|
+
`comtypes` allows you to define, call, and implement custom and dispatch-based COM interfaces in pure Python.
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
`comtypes` requires Windows and Python 3.8 or later.
|
|
14
|
+
- Version [1.4.6](https://pypi.org/project/comtypes/1.4.6/) is the last version to support Python 3.7.
|
|
15
|
+
- Version [1.2.1](https://pypi.org/project/comtypes/1.2.1/) is the last version to support Python 2.7 and 3.3–3.6.
|
|
16
|
+
- `comtypes` does not work with Python 3.8.1 as reported in [GH-202](https://github.com/enthought/comtypes/issues/202). This bug has been fixed in Python >= 3.8.2.
|
|
17
|
+
- Certain `comtypes` functions may not work correctly in Python 3.8 and 3.9 as reported in [GH-212](https://github.com/enthought/comtypes/issues/212). This bug has been fixed in Python >= 3.10.10 and >= 3.11.2.
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
- [`comtypes==1.2.1`](https://pypi.org/project/comtypes/1.2.1/) is the last version supporting `Python` 2.7 and 3.3-3.6.
|
|
18
|
-
- In `Python` 3.7.6 and 3.8.1, `comtypes` would not work as reported in [GH-202](https://github.com/enthought/comtypes/issues/202).
|
|
19
|
-
This bug has been fixed in `Python` >= 3.7.7 and >= 3.8.2.
|
|
20
|
-
- In `Python` 3.8 and 3.9, some of `comtypes` functionalities may not work correctly as reported in [GH-212](https://github.com/enthought/comtypes/issues/212).
|
|
21
|
-
This bug has been fixed in `Python` >= 3.10.10 and >= 3.11.2.
|
|
22
|
-
|
|
23
|
-
## Where to get it
|
|
24
|
-
|
|
25
|
-
The source code is currently hosted on GitHub at:
|
|
26
|
-
https://github.com/enthought/comtypes
|
|
27
|
-
|
|
28
|
-
An installer for the latest released version is available at the [Python Package Index (PyPI)](https://pypi.org/project/comtypes).
|
|
19
|
+
## Installation
|
|
29
20
|
|
|
21
|
+
`comtypes` is available on [PyPI](https://pypi.org/project/comtypes) and can be installed with `pip`:
|
|
30
22
|
```sh
|
|
31
23
|
# PyPI
|
|
32
24
|
pip install comtypes
|
|
33
25
|
```
|
|
34
26
|
|
|
35
|
-
|
|
27
|
+
The source code is currently hosted [here](https://github.com/enthought/comtypes) on GitHub.
|
|
28
|
+
|
|
29
|
+
### Dependencies
|
|
36
30
|
|
|
37
|
-
`comtypes`
|
|
31
|
+
`comtypes` is a pure Python package — it has no additional required dependencies.
|
|
38
32
|
|
|
39
|
-
Optional
|
|
40
|
-
- to process arrays as `numpy`'s `ndarray
|
|
41
|
-
-
|
|
33
|
+
Optional functionalities can be enabled by installing:
|
|
34
|
+
- `numpy`, in order to process arrays as `numpy`'s `ndarray`.
|
|
35
|
+
- `mypy` or other static type checkers, in order to interpret type hints.
|
|
42
36
|
|
|
43
|
-
|
|
37
|
+
None of these packages, however, are required in order to run `comtypes`.
|
|
44
38
|
|
|
45
|
-
## Community
|
|
39
|
+
## Community
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
https://github.com/enthought/comtypes
|
|
41
|
+
The [GitHub repository](https://github.com/enthought/comtypes) is used for tracking issues, reporting bugs, and contributing to the codebase and documentation.
|
|
49
42
|
|
|
50
43
|
## For Enterprise
|
|
51
44
|
|
|
@@ -58,17 +51,17 @@ This project and the maintainers of thousands of other packages are working with
|
|
|
58
51
|
## Frequently Asked Questions
|
|
59
52
|
|
|
60
53
|
### Q: Why does this package not support platforms other than Windows?
|
|
61
|
-
**A:**
|
|
54
|
+
**A:** The [Microsoft Component Object Model (COM)](https://learn.microsoft.com/en-us/windows/win32/com/com-technical-overview) is a technology that is unique to Windows and is not supported on other platforms.
|
|
62
55
|
|
|
63
56
|
[The phrase _"COM is a platform-independent"_ in the MS documentation](https://learn.microsoft.com/en-us/windows/win32/com/component-object-model--com--portal) means that COM maintains compatibility across different versions of Windows, and does NOT imply that it is supported on Linux or Mac.
|
|
64
57
|
|
|
65
|
-
|
|
58
|
+
For as long as COM is not supported outside of Windows, there is no plan to port `comtypes` to other platforms.
|
|
66
59
|
|
|
67
60
|
### Q: Why does `cannot import name 'COMError' from '_ctypes'` error occur when using this package on platforms other than Windows?
|
|
68
|
-
**A:** The [`_ctypes`](https://github.com/python/cpython/blob/main/Modules/_ctypes/_ctypes.c) is part of the internal implementation of the [`ctypes`](https://github.com/python/cpython/blob/main/Lib/ctypes/) standard library that exists for Python on all platforms.
|
|
69
|
-
However, `COMError` and COM-related features are implemented
|
|
61
|
+
**A:** The [`_ctypes`](https://github.com/python/cpython/blob/main/Modules/_ctypes/_ctypes.c) is part of the internal implementation of the [`ctypes`](https://github.com/python/cpython/blob/main/Lib/ctypes/) standard library that exists for Python on all platforms.
|
|
62
|
+
However, `COMError` and COM-related features are only implemented in Python for Windows.
|
|
70
63
|
|
|
71
|
-
In cross-platform software development, care must be taken to ensure that
|
|
64
|
+
In cross-platform software development, care must be taken to ensure that codebases that depend on `comtypes` do not execute in environments other than Windows.
|
|
72
65
|
|
|
73
66
|
### Q: Despite a script that depends on `comtypes` having run successfully before, a error (`ImportError`, `NameError`, or `SyntaxError`) is raised now, and the same error occurs again and again.
|
|
74
67
|
|
|
@@ -83,7 +76,6 @@ After deleting these partial modules and running the script again, `comtypes.cli
|
|
|
83
76
|
|
|
84
77
|
However, if the script implementation does not use `comtypes.client.GetModule` or processes generated files, it may not be a solution.
|
|
85
78
|
|
|
86
|
-
## Documentation
|
|
79
|
+
## Documentation
|
|
87
80
|
|
|
88
|
-
The documentation is currently hosted on
|
|
89
|
-
https://pythonhosted.org/comtypes
|
|
81
|
+
The documentation is currently hosted [here](https://pythonhosted.org/comtypes) on PythonHosted.
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
from ctypes import _SimpleCData, windll
|
|
2
|
+
from typing import Any, Callable, TYPE_CHECKING
|
|
3
|
+
|
|
4
|
+
if TYPE_CHECKING:
|
|
5
|
+
from comtypes import hints # type: ignore
|
|
2
6
|
|
|
3
7
|
|
|
4
8
|
class BSTR(_SimpleCData):
|
|
5
|
-
"The windows BSTR data type"
|
|
9
|
+
"""The windows BSTR data type"""
|
|
10
|
+
|
|
6
11
|
_type_ = "X"
|
|
7
12
|
_needsfree = False
|
|
8
13
|
|
|
9
|
-
def __repr__(self):
|
|
10
|
-
return "
|
|
14
|
+
def __repr__(self) -> str:
|
|
15
|
+
return f"{self.__class__.__name__}({self.value!r})"
|
|
11
16
|
|
|
12
|
-
def __ctypes_from_outparam__(self):
|
|
17
|
+
def __ctypes_from_outparam__(self) -> Any:
|
|
13
18
|
self._needsfree = True
|
|
14
19
|
return self.value
|
|
15
20
|
|
|
16
|
-
def __del__(
|
|
21
|
+
def __del__(
|
|
22
|
+
self, _free: Callable[["BSTR"], Any] = windll.oleaut32.SysFreeString
|
|
23
|
+
) -> None:
|
|
17
24
|
# Free the string if self owns the memory
|
|
18
25
|
# or if instructed by __ctypes_from_outparam__.
|
|
19
26
|
if self._b_base_ is None or self._needsfree:
|
|
20
27
|
_free(self)
|
|
21
28
|
|
|
22
29
|
@classmethod
|
|
23
|
-
def from_param(cls, value):
|
|
30
|
+
def from_param(cls, value: Any) -> "hints.Self":
|
|
24
31
|
"""Convert into a foreign function call parameter."""
|
|
25
32
|
if isinstance(value, cls):
|
|
26
33
|
return value
|
|
@@ -4,7 +4,7 @@ import datetime
|
|
|
4
4
|
import decimal
|
|
5
5
|
import sys
|
|
6
6
|
from ctypes import *
|
|
7
|
-
from ctypes import _Pointer
|
|
7
|
+
from ctypes import _Pointer, Array as _CArrayType
|
|
8
8
|
from _ctypes import CopyComPointer
|
|
9
9
|
from ctypes.wintypes import DWORD, LONG, UINT, VARIANT_BOOL, WCHAR, WORD
|
|
10
10
|
from typing import Any, ClassVar, Dict, List, Optional, TYPE_CHECKING, Type
|
|
@@ -16,9 +16,11 @@ import comtypes.patcher
|
|
|
16
16
|
import comtypes
|
|
17
17
|
|
|
18
18
|
if TYPE_CHECKING:
|
|
19
|
+
from ctypes import _CArgObject
|
|
19
20
|
from comtypes import hints # type: ignore
|
|
20
21
|
from comtypes import _safearray
|
|
21
22
|
else:
|
|
23
|
+
_CArgObject = type(byref(c_int()))
|
|
22
24
|
try:
|
|
23
25
|
from comtypes import _safearray
|
|
24
26
|
except (ImportError, AttributeError):
|
|
@@ -50,7 +52,6 @@ INVOKEKIND = tagINVOKEKIND
|
|
|
50
52
|
# helpers
|
|
51
53
|
IID_NULL = GUID()
|
|
52
54
|
riid_null = byref(IID_NULL)
|
|
53
|
-
_byref_type = type(byref(c_int()))
|
|
54
55
|
|
|
55
56
|
# 30. December 1899, midnight. For VT_DATE.
|
|
56
57
|
_com_null_date = datetime.datetime(1899, 12, 30, 0, 0, 0)
|
|
@@ -129,7 +130,7 @@ class tagDEC(Structure):
|
|
|
129
130
|
("Lo64", c_ulonglong),
|
|
130
131
|
]
|
|
131
132
|
|
|
132
|
-
def as_decimal(self):
|
|
133
|
+
def as_decimal(self) -> decimal.Decimal:
|
|
133
134
|
"""Convert a tagDEC struct to Decimal.
|
|
134
135
|
|
|
135
136
|
See http://msdn.microsoft.com/en-us/library/cc234586.aspx for the tagDEC
|
|
@@ -137,12 +138,8 @@ class tagDEC(Structure):
|
|
|
137
138
|
|
|
138
139
|
"""
|
|
139
140
|
digits = (self.Hi32 << 64) + self.Lo64
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
digits,
|
|
143
|
-
self.scale,
|
|
144
|
-
)
|
|
145
|
-
return decimal.Decimal(decimal_str)
|
|
141
|
+
sign = "-" if self.sign else ""
|
|
142
|
+
return decimal.Decimal(f"{sign}{digits}e-{self.scale}")
|
|
146
143
|
|
|
147
144
|
|
|
148
145
|
DECIMAL = tagDEC
|
|
@@ -382,7 +379,7 @@ class tagVARIANT(Structure):
|
|
|
382
379
|
elif isinstance(value, c_uint64):
|
|
383
380
|
self.vt = VT_UI8
|
|
384
381
|
self._.VT_UI8 = value
|
|
385
|
-
elif isinstance(value,
|
|
382
|
+
elif isinstance(value, _CArgObject):
|
|
386
383
|
ref = value._obj
|
|
387
384
|
self._.c_void_p = addressof(ref)
|
|
388
385
|
self.__keepref = value
|
|
@@ -609,9 +606,6 @@ v.vt = VT_ERROR
|
|
|
609
606
|
v._.VT_I4 = 0x80020004
|
|
610
607
|
del v
|
|
611
608
|
|
|
612
|
-
_carg_obj = type(byref(c_int()))
|
|
613
|
-
from ctypes import Array as _CArrayType
|
|
614
|
-
|
|
615
609
|
|
|
616
610
|
@comtypes.patcher.Patch(POINTER(VARIANT))
|
|
617
611
|
class _(object):
|
|
@@ -626,7 +620,7 @@ class _(object):
|
|
|
626
620
|
if isinstance(arg, POINTER(VARIANT)):
|
|
627
621
|
return arg
|
|
628
622
|
# accept byref(VARIANT) instance
|
|
629
|
-
if isinstance(arg,
|
|
623
|
+
if isinstance(arg, _CArgObject) and isinstance(arg._obj, VARIANT):
|
|
630
624
|
return arg
|
|
631
625
|
# accept VARIANT instance
|
|
632
626
|
if isinstance(arg, VARIANT):
|
|
@@ -750,7 +744,7 @@ EXCEPINFO = tagEXCEPINFO
|
|
|
750
744
|
|
|
751
745
|
class tagDISPPARAMS(Structure):
|
|
752
746
|
if TYPE_CHECKING:
|
|
753
|
-
rgvarg:
|
|
747
|
+
rgvarg: _CArrayType[VARIANT]
|
|
754
748
|
rgdispidNamedArgs: _Pointer[DISPID]
|
|
755
749
|
cArgs: int
|
|
756
750
|
cNamedArgs: int
|
|
@@ -10,8 +10,10 @@ from typing import Callable, Iterator, Sequence
|
|
|
10
10
|
|
|
11
11
|
if sys.version_info >= (3, 8):
|
|
12
12
|
from typing import Protocol
|
|
13
|
+
from typing import Literal as Literal
|
|
13
14
|
else:
|
|
14
15
|
from typing_extensions import Protocol
|
|
16
|
+
from typing_extensions import Literal as Literal
|
|
15
17
|
if sys.version_info >= (3, 9):
|
|
16
18
|
from typing import Annotated as Annotated
|
|
17
19
|
else:
|
|
@@ -9,12 +9,19 @@
|
|
|
9
9
|
The 'DictPropertyBag' class is a class implementing the IPropertyBag
|
|
10
10
|
interface, useful in client code.
|
|
11
11
|
"""
|
|
12
|
-
from ctypes import
|
|
12
|
+
from ctypes import c_int, c_ulong, c_ushort, c_wchar_p
|
|
13
|
+
from ctypes import POINTER, Structure
|
|
13
14
|
from ctypes.wintypes import WORD, DWORD, BOOL
|
|
14
|
-
from
|
|
15
|
+
from typing import TYPE_CHECKING
|
|
16
|
+
|
|
17
|
+
from comtypes import GUID, IUnknown, COMMETHOD, HRESULT
|
|
15
18
|
from comtypes import IPersist
|
|
16
19
|
from comtypes.automation import VARIANT, tagEXCEPINFO
|
|
17
20
|
|
|
21
|
+
if TYPE_CHECKING:
|
|
22
|
+
from comtypes import hints # type: ignore
|
|
23
|
+
|
|
24
|
+
|
|
18
25
|
# XXX Replace by canonical solution!!!
|
|
19
26
|
WSTRING = c_wchar_p
|
|
20
27
|
|
|
@@ -236,9 +243,18 @@ class IPersistFile(IPersist):
|
|
|
236
243
|
),
|
|
237
244
|
]
|
|
238
245
|
|
|
246
|
+
if TYPE_CHECKING:
|
|
247
|
+
# fmt: off
|
|
248
|
+
def IsDirty(self) -> hints.Hresult: ... # noqa
|
|
249
|
+
def Load(self, pszFileName: str, dwMode: int) -> hints.Hresult: ... # noqa
|
|
250
|
+
def Save(self, pszFileName: str, fRemember: bool) -> hints.Hresult: ... # noqa
|
|
251
|
+
def SaveCompleted(self, pszFileName: str) -> hints.Hresult: ... # noqa
|
|
252
|
+
def GetCurFile(self) -> str: ... # noqa
|
|
253
|
+
# fmt: on
|
|
254
|
+
|
|
239
255
|
|
|
240
256
|
from comtypes import COMObject
|
|
241
|
-
from comtypes.hresult import
|
|
257
|
+
from comtypes.hresult import E_INVALIDARG, S_OK
|
|
242
258
|
|
|
243
259
|
|
|
244
260
|
class DictPropertyBag(COMObject):
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
from __future__ import print_function
|
|
2
|
-
from ctypes import
|
|
2
|
+
from ctypes import c_char_p, c_int, c_short, c_wchar_p
|
|
3
|
+
from ctypes import POINTER
|
|
4
|
+
from ctypes import byref, create_string_buffer, create_unicode_buffer
|
|
3
5
|
from ctypes.wintypes import DWORD, WIN32_FIND_DATAA, WIN32_FIND_DATAW, MAX_PATH
|
|
6
|
+
from typing import Tuple, TYPE_CHECKING
|
|
7
|
+
|
|
4
8
|
from comtypes import IUnknown, GUID, COMMETHOD, HRESULT, CoClass
|
|
5
9
|
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from comtypes import hints # type: ignore
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
# for GetPath
|
|
7
16
|
SLGP_SHORTPATH = 0x1
|
|
8
17
|
SLGP_UNCPRIORITY = 0x2
|
|
@@ -113,31 +122,52 @@ class IShellLinkA(IUnknown):
|
|
|
113
122
|
COMMETHOD([], HRESULT, "SetPath", (["in"], c_char_p, "pszFile")),
|
|
114
123
|
]
|
|
115
124
|
|
|
116
|
-
|
|
125
|
+
if TYPE_CHECKING:
|
|
126
|
+
# fmt: off
|
|
127
|
+
def GetIDList(self) -> hints.Incomplete: ... # noqa
|
|
128
|
+
def SetIDList(self, pidl: hints.Incomplete) -> hints.Incomplete: ... # noqa
|
|
129
|
+
def SetDescription(self, pszName: bytes) -> hints.Incomplete: ... # noqa
|
|
130
|
+
def SetWorkingDirectory(self, pszDir: bytes) -> hints.Hresult: ... # noqa
|
|
131
|
+
def SetArguments(self, pszArgs: bytes) -> hints.Hresult: ... # noqa
|
|
132
|
+
@property
|
|
133
|
+
def Hotkey(self) -> int: ... # noqa
|
|
134
|
+
@Hotkey.setter
|
|
135
|
+
def Hotkey(self, pwHotkey: int) -> None: ... # noqa
|
|
136
|
+
@property
|
|
137
|
+
def ShowCmd(self) -> int: ... # noqa
|
|
138
|
+
@ShowCmd.setter
|
|
139
|
+
def ShowCmd(self, piShowCmd: int) -> None: ... # noqa
|
|
140
|
+
def SetIconLocation(self, pszIconPath: bytes, iIcon: int) -> hints.Hresult: ... # noqa
|
|
141
|
+
def SetRelativePath(self, pszPathRel: bytes, dwReserved: hints.Literal[0]) -> hints.Hresult: ... # noqa
|
|
142
|
+
def Resolve(self, hwnd: int, fFlags: int) -> hints.Hresult: ... # noqa
|
|
143
|
+
def SetPath(self, pszFile: bytes) -> hints.Hresult: ... # noqa
|
|
144
|
+
# fmt: on
|
|
145
|
+
|
|
146
|
+
def GetPath(self, flags: int = SLGP_SHORTPATH) -> bytes:
|
|
117
147
|
buf = create_string_buffer(MAX_PATH)
|
|
118
148
|
# We're not interested in WIN32_FIND_DATA
|
|
119
|
-
self.__com_GetPath(buf, MAX_PATH, None, flags)
|
|
149
|
+
self.__com_GetPath(buf, MAX_PATH, None, flags) # type: ignore
|
|
120
150
|
return buf.value
|
|
121
151
|
|
|
122
|
-
def GetDescription(self):
|
|
152
|
+
def GetDescription(self) -> bytes:
|
|
123
153
|
buf = create_string_buffer(1024)
|
|
124
|
-
self.__com_GetDescription(buf, 1024)
|
|
154
|
+
self.__com_GetDescription(buf, 1024) # type: ignore
|
|
125
155
|
return buf.value
|
|
126
156
|
|
|
127
|
-
def GetWorkingDirectory(self):
|
|
157
|
+
def GetWorkingDirectory(self) -> bytes:
|
|
128
158
|
buf = create_string_buffer(MAX_PATH)
|
|
129
|
-
self.__com_GetWorkingDirectory(buf, MAX_PATH)
|
|
159
|
+
self.__com_GetWorkingDirectory(buf, MAX_PATH) # type: ignore
|
|
130
160
|
return buf.value
|
|
131
161
|
|
|
132
|
-
def GetArguments(self):
|
|
162
|
+
def GetArguments(self) -> bytes:
|
|
133
163
|
buf = create_string_buffer(1024)
|
|
134
|
-
self.__com_GetArguments(buf, 1024)
|
|
164
|
+
self.__com_GetArguments(buf, 1024) # type: ignore
|
|
135
165
|
return buf.value
|
|
136
166
|
|
|
137
|
-
def GetIconLocation(self):
|
|
167
|
+
def GetIconLocation(self) -> Tuple[bytes, int]:
|
|
138
168
|
iIcon = c_int()
|
|
139
169
|
buf = create_string_buffer(MAX_PATH)
|
|
140
|
-
self.__com_GetIconLocation(buf, MAX_PATH, byref(iIcon))
|
|
170
|
+
self.__com_GetIconLocation(buf, MAX_PATH, byref(iIcon)) # type: ignore
|
|
141
171
|
return buf.value, iIcon.value
|
|
142
172
|
|
|
143
173
|
|
|
@@ -226,31 +256,52 @@ class IShellLinkW(IUnknown):
|
|
|
226
256
|
COMMETHOD([], HRESULT, "SetPath", (["in"], c_wchar_p, "pszFile")),
|
|
227
257
|
]
|
|
228
258
|
|
|
229
|
-
|
|
259
|
+
if TYPE_CHECKING:
|
|
260
|
+
# fmt: off
|
|
261
|
+
def GetIDList(self) -> hints.Incomplete: ... # noqa
|
|
262
|
+
def SetIDList(self, pidl: hints.Incomplete) -> hints.Incomplete: ... # noqa
|
|
263
|
+
def SetDescription(self, pszName: str) -> hints.Incomplete: ... # noqa
|
|
264
|
+
def SetWorkingDirectory(self, pszDir: str) -> hints.Hresult: ... # noqa
|
|
265
|
+
def SetArguments(self, pszArgs: str) -> hints.Hresult: ... # noqa
|
|
266
|
+
@property
|
|
267
|
+
def Hotkey(self) -> int: ... # noqa
|
|
268
|
+
@Hotkey.setter
|
|
269
|
+
def Hotkey(self, pwHotkey: int) -> None: ... # noqa
|
|
270
|
+
@property
|
|
271
|
+
def ShowCmd(self) -> int: ... # noqa
|
|
272
|
+
@ShowCmd.setter
|
|
273
|
+
def ShowCmd(self, piShowCmd: int) -> None: ... # noqa
|
|
274
|
+
def SetIconLocation(self, pszIconPath: str, iIcon: int) -> hints.Hresult: ... # noqa
|
|
275
|
+
def SetRelativePath(self, pszPathRel: str, dwReserved: hints.Literal[0]) -> hints.Hresult: ... # noqa
|
|
276
|
+
def Resolve(self, hwnd: int, fFlags: int) -> hints.Hresult: ... # noqa
|
|
277
|
+
def SetPath(self, pszFile: str) -> hints.Hresult: ... # noqa
|
|
278
|
+
# fmt: on
|
|
279
|
+
|
|
280
|
+
def GetPath(self, flags: int = SLGP_SHORTPATH) -> str:
|
|
230
281
|
buf = create_unicode_buffer(MAX_PATH)
|
|
231
282
|
# We're not interested in WIN32_FIND_DATA
|
|
232
|
-
self.__com_GetPath(buf, MAX_PATH, None, flags)
|
|
283
|
+
self.__com_GetPath(buf, MAX_PATH, None, flags) # type: ignore
|
|
233
284
|
return buf.value
|
|
234
285
|
|
|
235
|
-
def GetDescription(self):
|
|
286
|
+
def GetDescription(self) -> str:
|
|
236
287
|
buf = create_unicode_buffer(1024)
|
|
237
|
-
self.__com_GetDescription(buf, 1024)
|
|
288
|
+
self.__com_GetDescription(buf, 1024) # type: ignore
|
|
238
289
|
return buf.value
|
|
239
290
|
|
|
240
|
-
def GetWorkingDirectory(self):
|
|
291
|
+
def GetWorkingDirectory(self) -> str:
|
|
241
292
|
buf = create_unicode_buffer(MAX_PATH)
|
|
242
|
-
self.__com_GetWorkingDirectory(buf, MAX_PATH)
|
|
293
|
+
self.__com_GetWorkingDirectory(buf, MAX_PATH) # type: ignore
|
|
243
294
|
return buf.value
|
|
244
295
|
|
|
245
|
-
def GetArguments(self):
|
|
296
|
+
def GetArguments(self) -> str:
|
|
246
297
|
buf = create_unicode_buffer(1024)
|
|
247
|
-
self.__com_GetArguments(buf, 1024)
|
|
298
|
+
self.__com_GetArguments(buf, 1024) # type: ignore
|
|
248
299
|
return buf.value
|
|
249
300
|
|
|
250
|
-
def GetIconLocation(self):
|
|
301
|
+
def GetIconLocation(self) -> Tuple[str, int]:
|
|
251
302
|
iIcon = c_int()
|
|
252
303
|
buf = create_unicode_buffer(MAX_PATH)
|
|
253
|
-
self.__com_GetIconLocation(buf, MAX_PATH, byref(iIcon))
|
|
304
|
+
self.__com_GetIconLocation(buf, MAX_PATH, byref(iIcon)) # type: ignore
|
|
254
305
|
return buf.value, iIcon.value
|
|
255
306
|
|
|
256
307
|
|
|
@@ -77,6 +77,15 @@ class Test_GetModule(ut.TestCase):
|
|
|
77
77
|
|
|
78
78
|
self.assertTrue(issubclass(mod.IStream, ISequentialStream))
|
|
79
79
|
|
|
80
|
+
def test_msvidctl(self):
|
|
81
|
+
with contextlib.redirect_stdout(None): # supress warnings
|
|
82
|
+
mod = comtypes.client.GetModule("msvidctl.dll")
|
|
83
|
+
from comtypes.persist import IPersist
|
|
84
|
+
from comtypes.typeinfo import IRecordInfo
|
|
85
|
+
|
|
86
|
+
self.assertIs(mod.IPersist, IPersist)
|
|
87
|
+
self.assertIs(mod.IRecordInfo, IRecordInfo)
|
|
88
|
+
|
|
80
89
|
def test_no_replacing_Patch_namespace(self):
|
|
81
90
|
# NOTE: An object named `Patch` is defined in some dll.
|
|
82
91
|
# Depending on how the namespace is defined in the static module,
|