Skip to content

Commit

Permalink
Update links and directives.
Browse files Browse the repository at this point in the history
  • Loading branch information
junkmd committed Dec 27, 2024
1 parent 5a64024 commit 9b5a233
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 31 deletions.
37 changes: 19 additions & 18 deletions docs/source/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ access COM objects.
Create a named COM object and returns an interface pointer to it.
For the interpretation of ``displayname`` consult the Microsoft
documentation for the Windows ``CoGetObject`` function.
``"winmgmts:"``, for example, is the displayname for `WMI
monikers`_:
``"winmgmts:"``, for example, is the displayname for
`WMI monikers <https://learn.microsoft.com/ja-jp/windows/win32/wmisdk/constructing-a-moniker-string>`_:

.. sourcecode:: python

Expand Down Expand Up @@ -258,8 +258,12 @@ VT_INT``, or an array a strings with typecode ``VT_ARRAY | VT_BSTR``.

To create these variants you must pass an instance of the Python
``array.array`` with the correct Python typecode to the COM method.
Note that NumPy arrays are also an option here, as is described in
the following section.

.. note::

NumPy arrays are also an option, as described in the
:doc:`npsupport` document.


The mapping of the ``array.array`` typecode to the ``VARIANT``
typecode is defined in the ``comtypes.automation`` module by a
Expand Down Expand Up @@ -339,8 +343,7 @@ based on so-called *connection points*.
.. note::

For the rules that you should observe when implementing event
handlers you should read the implementing_COM_methods_ section in
the |comtypes| server document.
handlers you should read the :doc:`server` document.


``GetEvents(source, sink, interface=None)``
Expand Down Expand Up @@ -476,9 +479,13 @@ and passes it as second parameter to the ``GetEvents()`` function:
FontChanged Name


Note that event handler methods support the same calling convention as
COM method implementations in |comtypes|. So the remarks about
implementing_COM_methods_ should be observed.
.. note::

Event handler methods support the same calling convention as COM
method implementations in |comtypes|. So the remarks about the
`"Implementing COM methods" section in the server document <server.html#implementing-com-methods>`_
should be observed.


Typelibraries
*************
Expand Down Expand Up @@ -532,9 +539,9 @@ from COM typelibraries.
abstracted alias ``__wrapper_module__``, also imports interface
classes, coclasses, constants, and structures from the wrapper
module, and defines enumerations from typeinfo of the typelibrary
using `enum.IntFlag`_. The friendly module can be imported
easier than the wrapper module because the module name is easier
to type and read.
using `enum.IntFlag <https://docs.python.org/3/library/enum.html#enum.IntFlag>`_.
The friendly module can be imported easier than the wrapper
module because the module name is easier to type and read.

For example, the typelibrary for Scripting Runtime has the name
``Scripting`` (this is the name specified in the type library
Expand Down Expand Up @@ -659,9 +666,3 @@ XXX describe logging, gen_dir, wrap, _manage (?)


.. |comtypes| replace:: ``comtypes``

.. _`WMI monikers`: http://www.microsoft.com/technet/scriptcenter/guide/sas_wmi_jgfx.mspx?mfr=true

.. _`enum.IntFlag`: https://docs.python.org/3/library/enum.html#enum.IntFlag

.. _implementing_COM_methods: server.html#implementing-com-methods
30 changes: 18 additions & 12 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
The ``comtypes`` package
########################

|comtypes| is a *pure Python* COM package based on the ctypes_ ffi
|comtypes| is a *pure Python* COM package based on the
`ctypes <https://docs.python.org/3/library/ctypes.html>`_ ffi
foreign function library. |ctypes| is included in Python 2.5 and
later, it is also available for Python 2.4 as separate download.

While the pywin32_ package contains superior client side support
for *dispatch based* COM interfaces, it is not possible to access
*custom* COM interfaces unless they are wrapped in C++-code.
While the `pywin32 <https://pypi.org/project/pywin32/>`_ package
contains superior client side support for *dispatch based* COM
interfaces, it is not possible to access *custom* COM interfaces
unless they are wrapped in C++-code.

The |comtypes| package makes it easy to access and implement both
custom and dispatch based COM interfaces.
Expand Down Expand Up @@ -46,18 +48,22 @@ Chen, Alicia (2012). `"Comtypes: How Dropbox learned to stop worrying and love t
Downloads
*********

The |comtypes| project is hosted on github_. Releases can be downloaded from
the github releases_ section.
The |comtypes| project is hosted on `GitHub <https://github.com/enthought/comtypes>`_.
Releases can be downloaded from the `GitHub releases <https://github.com/enthought/comtypes/releases>`_
section.


.. |comtypes| replace:: ``comtypes``
Installation
************

.. |ctypes| replace:: ``ctypes``
|comtypes| is available on `PyPI <https://pypi.org/project/comtypes>`_ and
can be installed with ``pip``:

.. _ctypes: https://docs.python.org/3/library/ctypes.html
.. sourcecode:: shell

.. _pywin32: https://pypi.org/project/pywin32/
pip install comtypes

.. _github: https://github.com/enthought/comtypes

.. _releases: https://github.com/enthought/comtypes/releases
.. |comtypes| replace:: ``comtypes``

.. |ctypes| replace:: ``ctypes``
2 changes: 1 addition & 1 deletion docs/source/server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ COM event handlers!

In the IDL file, the method signature is defined like this:

.. sourcecode:: c
.. sourcecode:: idl

HRESULT MyMethod([in] INT a, [in] INT b, [out, retval] INT *presult);
Expand Down

0 comments on commit 9b5a233

Please sign in to comment.