-------------
* 27: Replaced the ``partial`` module with a ``patcher`` module. This new
technique patches the underlying classes explicitly. This technique avoids
the problems with the metaclass magic on Python 3.
* Officially dropped support for Python 2.5.
* 25: Allow installation on non-Windows systems.
* 31: Improved 64-bit compatibility by specifying argtypes for GetMessage.
Earlier Changes
---------------
2010-04-09 Thomas Heller <thellerpython.net>
* comtypes.client.dynamic: Added _FlagAsMethod(*names) method
to the _Dispatch class.
This allows to flag these attribute names as being methods. Some
objects do not correctly differentiate methods and properties,
leading to problems when calling these methods.
2010-02-23 Thomas Heller <thellerpython.net>
* pointers and byref() objects will now be stored in a VARIANT as
VT_BYREF type. This allows to call dispinterface methods with
BYREF arguments.
2010-01-21 Thomas Heller <thellerpython.net>
* Add a __repr__ method to named_property and bound_named_property
object.
2010-01-15 Thomas Heller <thellerpython.net>
* Bump version number to 0.6.3dev: development version.
2010-01-15 Thomas Heller <thellerpython.net>
* Bumped version number to 0.6.2.
* CoUninitialize() returns nothing, not HRESULT.
2009-12-22 Thomas Heller <thellerpython.net>
* Bug fixes for event handlers implemented in Python.
2009-12-11 Thomas Heller <thellerpython.net>
* COM servers implemented in Python can now fire events; it did
not work in some cases.
* When an exception occurs in a COM event handler, a traceback is
printed.
2009-11-26 Thomas Heller <thellerpython.net>
* Allow typelib wrappers that contain 'SAFEARRAY(VARIANT*)'
parameter types to be imported. Calling these methods will fail,
though.
2009-11-13 Thomas Heller <thellerpython.net>
* To avoid a memory leak when PyInitialize()/PyUninitialize() are
called several times, return S_FALSE from inproc server's
DllCanUnloadNow().
2009-11-05 Thomas Heller <thellerpython.net>
* COMObject subclasses can now implement a _final_release_()
method to free up resources, for example. This method is called
when the COM reference count reaches zero.
* Implement __hash__ method in dynamic dispatch classes. This
fixes a 'python -3' warning.
* comtypes\safearray.py: When numpy is not installed, creating
safearrays took a very long time. This is fixed now.
* comtypes\test\test_server.py: New way to test COM client and
server. Work in progress.
2009-10-22 Thomas Heller <thellerpython.net>
* Support broken COM objects that provide IProvideClassInfo2, but
not IProvideClassInfo (although the latter is derived from the
former). See
http://sourceforge.net/tracker/index.php?func=detail&aid=2829887&group_id=115265&atid=692942
* Fixed a regression from the 0.4 version, [out] parameters didn't
accept pointers or arrays any longer. Thanks again to Michael
Eddington.
2009-10-19 Thomas Heller <thellerpython.net>
* Fix a memory leak in Python COM servers. Thanks to Michael
Eddington for the patch.
2009-10-02 Thomas Heller <thellerpython.net>
* comtypes\test\test_server.py: Start a better approach to test
both COM object calls and COM object implementations.
2009-09-09 Thomas Heller <thellerpython.net>
* Fix returning SAFEARRAY of VT_RECORDs. Based on a patch from
Eduardo Arias.
* New module comtypes.viewobject, contains the interfaces
IViewObject, IViewObject2, IViewObjectEx. IAdviseSink is faked.
* Change version number to 0.6.2dev.
2009-09-04 Thomas Heller <thellerpython.net>
* CoTaskMemFree does not return a HRESULT. Patch from James Teh.
2009-08-19 Thomas Heller <thellerpython.net>
* Bumped version number to 0.6.1.
2009-08-07 Thomas Heller <thellerpython.net>
* When an interface was specified in the call to
IClassObject.CreateInstance, return that instead of calling
GetBestInterface. Patch from James Teh.
2009-08-04 Thomas Heller <thellerpython.net>
* Added comtypes.CoGetClassObject() low-level function,
comtypes.client.GetClassObject() high-level function, and
implemented a pythonic interface to IClassFactory's CreateInstance
method:
def CreateInstance(self,
punkouter=None,
interface=None,
dynamic=False)
* Added the 'dynamic=False' parameter to the
comtypes.client.CoGetObject and comtypes.client.GetActiveObject
functions. Suggested by James Teh.
2009-06-17 Thomas Heller <thellerpython.net>
* comtypes.automation: Support VT_I8 and VT_UI8 SAFEARRAYs.
* comtypes._comobject: Restore compatibility with Python 2.3.
* Add the comtypes.IServiceProvider interface. Based on a patch
from Michael Curran.
2009-04-30 Thomas Heller <thellerpython.net>
* Change version number in repository to 0.6.0.2dev.
* Replace the VARIANTEnumerator implementation class in
comtypes.server.automation with a new one which should actually be
usable.
* A completely new way how localserver and inproc server instances
are managed:
A comtypes.LocalServer or comtypes.InprocServer instance
is attached to the comtypes.COMObject class at runtime.
These changes keep localserver running as long as
COMObject instances are alive.
2009-04-29 Thomas Heller <thellerpython.net>
* comtypes.errorinfo.ReportException now takes an additional
'stacklevel' named argument.
* Add E_OUTOFMEMORY hresult code.
* Register the InprocServer32 only when running as script or
py2exe dll, not when running as py2exe exe server.
2009-04-25 Thomas Heller <thellerpython.net>
* SAFEARRAYs can now also be created from multi-dimensional numpy
arrays.
2009-04-23 Thomas Heller <thellerpython.net>
* Change version number in repository to 0.6.0.1dev.
* SAFEARRAYs can now also be created from array.array objects, and
from (one-dimensional) numpy arrays. This is a lot faster than
creating them from Python lists or tuples, at least for large
arrays.
* ctypes instances like c_int, c_ubyte, and so on can now be
assigned to VARIANT().value. This allows to force creation of
VARIANTs with the corresponding typecodes V_I4, VT_UI1 and alike.
* Accept typelibs that contain SAFEARRAY(char).
2009-03-17 Thomas Heller <thellerpython.net>
* Fixed the return type of ITypeLib::ReleaseTLibAttr, which is
documented wrongly in MSDN. The return type is void, not HRESULT.
Reported to cause crashes on Windows 7.
2009-01-29 Thomas Heller <thellerpython.net>
* Restore compatibility with Python 2.3.
* comtypes\client\_code_cache.py: Add missing 'import types' in
comtypes\client\_code_cache.py.
2008-12-19 Thomas Heller <thellerpython.net>
* Bumped version number to 0.6.0.
* comtypes.client.lazybind.Dipatch:
If __getitem__ fails the get the indexed default value, try
NewENUM. Implement __eq__ for Python 3 compatibility.
* Fix a problem with SAFEARRAYs where the contained data was
released too early.
* Fix property get handling for FUNC_PUREVIRTUAL functions in
lazybind.py
2008-12-18 Thomas Heller <thellerpython.net>
* Fix memoryleak in IEnumVARIANT.
2008-12-12 Thomas Heller <thellerpython.net>
* Merged changes from the dyndispatch branch:
* Add a comtypes.client.Constants class that provides a way to
access constants in the type library for an object, even when
no wrapper has been created for the type library. The
contants can be accessed as attributes like this, assuming
'obj' is a COM object that exposes type information at runtime
via the dispatch interface:
Constants(obj).MyConstant
* New comtypes.client.lazybind module.
* Implement NamedProperty.__call__(). Extend
NamedProperty.__getitem__() and NamedProperty.__setitem__() so
that they accept a tuple, which make lazy bound objects more
compatible with early bound objects.
* Finished (for now) the comtypes.client.lazybind module.
IEnumVARIANT instances get a _dynamic attribute which defaults
to False. The values returned from next() calls are retrived
by calling ._set_value(self._dynamic) on the VARIANT result.
* comtypes.client.dynamic:
* Started changes based on ideas from Michael Curran: better
dynamic dispatch support, and a way to disable the
time-consuming wrapper code generation on demand.
* comtypes\client: Add a new 'dynamic=False' parameter to the
CreateObject function. This parameter allows to create a
dynamic dispatch object, bypassing the code generation.
* comtypes\automation.py: Add a new parameter to the
VARIANT._get_value(dynamic=False) method. This allows to
retrieve the current value as a _Dispatch() instance if the
typecode is VT_DISPATCH, bypassing the code generation on the
result. The IDispatch.Invoke implementation now uses this to
ensure that dynamic objects are returned when possible.
* comtypes\client\dynamic.py: Implement _Dispatch.__eq__ so
that we can compare instances for equality.
2008-12-12 Thomas Heller <thellerpython.net>
* Bumped version number to 0.5.3.
* Added VARIANT support for VT_I8 and VT_UI8 typecodes.
2008-12-11 Thomas Heller <thellerpython.net>
* Workaround for Python bug: Python 3 cannot handle a distutils
installscript in the setup script
* Merged the py3-branch:
Various changes for py3 compatibility. The setup script now uses
distutils.command.build_py.build_py_2to3 when run with Python 3.x,
and converts the sources into py3 syntax on the fly (in the build
directory).
2008-11-26 Thomas Heller <thellerpython.net>
* Added untested code to comtypes.server: RegisterActiveObject()
and RevokeActiveObject(), plus some flags.
* Applied a patch from Torbjørn Tyridal. This allows to
high-level implement methods in COM servers, and event handler
methods that have [in] and [out] arguments in mixed order.
2008-11-05 Thomas Heller <thellerpython.net>
* Add the IPersistFile interface to the comtypes.persist module.
Add comtypes.shelllink module which contains IShellLinkA and
IShellLinkW interfaces, plus the ShellLink coclass.
2008-10-29 Thomas Heller <thellerpython.net>
* Handle coclass pointers as arguments in com interface methods
correctly. Method calls will now accept pointers to the default
interface of this coclass.
* The Fire_Event() method in comtypes.server.connectionpoints now
returns a list of results.
2008-10-10 Thomas Heller <thellerpython.net>
* Import cStringIO, which should always be available on Windows,
instead of first trying cStringIO and then StringIO.
* Python 2.6 compatibility: use 'types.MethodType' instead of
'new.instancemethod' to fix a -3 warning.
Use 'raise Exception(details)' instead of
'raise Exception, details'.
Don't use tuple unpacking in exception handlers:
'except COMError, err:
(hresult, text, details) = err'
instead of
'except COMError, (hresult, text, details)'
* Python 2.4 compatibility: os.stat() raises OSError instead of
WindowsError when a file is not found.
2008-09-19 Thomas Heller <thellerpython.net>
* Bump version number to 0.5.3dev.
* Bump version number to 0.5.2.
Released comtypes-0.5.2.
* COMError nows prints the contained hresult in hex.
2008-09-18 Thomas Heller <thellerpython.net>
* Changed the version-checking code that the code generator
creates. Reintroduced (sorry, Anthony!) the comparison of
timestamps, if both the typelib and the generated module are
files.
2008-09-10 Thomas Heller <thellerpython.net>
* In comtypes\_comobject.py, Invoke: Named arguments passed to
COMObject.IDispatch_Invoke are now (hopefully!) unpacked
correctly. This should fix the order of parameters passed to MS
office (Word, Excel) and other (autocad?) event handlers.
2008-09-04 Thomas Heller <thellerpython.net>
* Removed the code that compared the timestamps of Python wrapper
modules and type library files - this approach was totally broken.
Generated modules are out of date if they were created by the code
generator module with a different version number; the version
number is now checked when a module is imported.
The current mechanism also works correctly for generated modules
in frozen scripts.
Thanks to Anthony Tuininga.
2008-08-27 Thomas Heller <thellerpython.net>
* Avoid double-free of BSTR strings under certain conditions.
* A NULL handler is now added to the comtypes logger; this
prevents messages like 'No handlers could be found for logger
"comtypes"' when an error message is logged and the logging module
is not configured.
https://sourceforge.net/tracker/index.php?func=detail&aid=2066024&group_id=115265&atid=692940
2008-08-20 Thomas Heller <thellerpython.net>
* Changed the codegenerator to generate 'c_longlong' instead of
'c_float' for CURRENCY. This is not really correct since the
CURRENCY value is a fixed point integer scaled by a factor of
10000, but at least the code will not crash. Need a test case.
* comtypes.server.register: Add an optional 'executable' parameter
to Registrar.register(cls), can be used to override the executable
image name that comtypes detects itself. Patch by Michael
Robellard.
2008-08-15 Thomas Heller <thellerpython.net>
* comtypes.client._find_gen_dir() improved (based on a patch and
helpful thoughts of Stefan Schukat): If comtypes.gen is not a
directory in the filesystem, or not writeable by users, a new
directory is created which will cache generated code. This could
be the case if comtypes is installed in a directory that has no
write permissions by the urrent user, if the comtypes package
resides in a zip-archive or a zipped egg, or if comtypes is used
in a py2exe'd script.
'%APPDATA%\<username>\Python\Python<XY>\comtypes_cache'
is used for a normal Python script, for a py2exe frozen executables
the directory will be
'%TEMP%\comtypes_cache\<imagebasename>-<XY>'
where <imagebasename> is the basename without extension of the
frozen executable image, and <XY> is the major and minor Python
version number, '25' for example.
This makes sure that generated modules will *always* cached in the
file system.
2008-08-13 Thomas Heller <thellerpython.net>
* comtypes\automation.py: Allow this module to be imported on
Windows CE. Using safearrays on Windows CE will not work. I'm not
sure if they are used much.
2008-08-08 Thomas Heller <thellerpython.net>
* Implement InterlockedIncrement and InterlockedDecrement for
win64.
2008-08-07 Thomas Heller <thellerpython.net>
* Bump version number to 0.5.1
* comtypes\tools\codegenerator.py: Change the order of the
interfaces in the _com_interfaces_ and _outgoing_interfaces_ list
so that the default interface is the first one. This fixes the
bug that GetEvents() and ShowEvents() sometimes did use the wrong
event interface.
2008-08-06 Thomas Heller <thellerpython.net>
* The repository was moved from python.org to sourceforge.net.
The svn trunk URL is now:
https://comtypes.svn.sourceforge.net/svnroot/comtypes/trunk
The script that extracted the repository is in
admin/extract_comtypes_repo. The repository structure and the
revision numbers have changed; the last revision on python.org is
rev 65336, this was imported as revision rev 355.
2008-07-18 Thomas Heller <thellerpython.net>
* comtypes\test\find_memleak.py: Windows CE does not have
GetProcessMemoryInfo; disable the find_memleak function because it
cannot work.
* comtypes\client\_generate.py, comtypes\typeinfo.py: Windows CE
doesn't have QueryPathOfRegTypeLib - try to emulate it. Also it
doesn't use tha PATH environment variable; use a hardcoded search
path for type libraries.
* comtypes\test\runtests.py: Define a main() function.
2008-05-29 Thomas Heller <thellerpython.net>
* Improved the [in, out] parameter workaround. These parameters
are now optional. Removed the special codegeneration for [in,
out] parameters in IEnumXXX.Next methods. Added test.
2008-05-16 Thomas Heller <thellerpython.net>
* Provide a workaround for a bug in ctypes. This allows methods
using [in, out] parameters to correctly convert native Python
values.
* comtypes/tools/tlbparser.py: When GetRefTypeInfo(hreftype)
fails, emit a warning and generate a fake type instead.
2008-05-07 Thomas Heller <thellerpython.net>
* Fixed the definition of VARIANT.empty and VARIANT.null; the
values were swapped.
https://sourceforge.net/tracker/?func=detail&atid=692940&aid=1959722&group_id=115265
2008-04-25 Thomas Heller <thellerpython.net>
* Replace logger.info() calls with logger.debug() since it is more
appropriate.
In comtypes.server.connectionpoints, when a event notification
fails with an error indicating that the event sink is no longer
present, close the connection and log a warning.
The __repr__ of VARIANT changed again to make it a little bit shorter.
VARIANT instances of VT_BREF are NOT unpacked when the .value
attribute as accessed. The value instead can be got or set by
indexing, so the api is the same as for pointer instances:
print byref_var[0]
byref_var[0] = value
2008-04-17 Thomas Heller <thellerpython.net>
* More changes merged from upstream svn 26400, add support for
implementing (non-dual) dispinterfaces (work in progress).
* Merge in a lot of changes from the private upstream repository
26394; mainly much better support for implementing comtypes
servers.
2008-04-09 Thomas Heller <thellerpython.net>
* Bump version number to 0.4.3a
* Released version comtypes 0.4.2.
* comtypes.util: New module, containing the byref_at() and
cast_field() helper functions.
2008-04-07 Thomas Heller <thellerpython.net>
* Fix the codegenerator to handle all kinds of IEnumXXX::Next
method signatures; the second and third parameters may be [out] or
[in, out].
2008-03-07 Thomas Heller <thellerpython.net>
* Implemented support for SAFEARRAYs containing com interface
pointers.
2008-03-04 Thomas Heller <thellerpython.net>
* Add comtypes.client.gen_dir to comtypes.gen.__path__ so that the
codegenerator can import its generated module(s).
2008-02-08 Thomas Heller <thellerpython.net>
* Hacked support for 'open array' [out] parameters in COM methods.
These are arrays that have both size_is() and length_is() in IDL.
See the comments in comtypes\tools\codegenerator.py, search for
'OPENARRAY'.
2008-02-06 Thomas Heller <thellerpython.net>
* The badly named comtypes.client.wrap function was renamed into
comtypes.client.GetBestInterface. For backwards compatibility the
old name stays as an alias.
* Replaced the comtypes.messageloop.add_filter(filter) function
with comtypes-messageloop.insert_filter(index, filter). This
allows to specify the order in which the filters are applied.
* Added a workaround for the buggy _ctypes.COMError in Python 2.5
and 2.51.
2007-12-19 Thomas Heller <thellerpython.net>
* Bump version number to 0.4.2.
* Special methods (__iter__ and so on) did not work on
dispinterfaces, because the __map_case__ dictionary was not
populated.
2007-11-23 Thomas Heller <thellerpython.net>
* Released version comtypes 0.4.1.
* Add a PumpEvents(timeout) function to comtypes.client. This
function calls the win32 CoWaitForMultipleHandles() function which
will wait in a way compatible with all types of apartments;
additionally this function can be interrupted with Control+C.
2007-11-21 Thomas Heller <thellerpython.net>
* comtypes\__init__.py: Add docstrings to special methods. Make
named_property a data descriptor by providing a __set__ method
(which will raise AttributeError when called).
2007-11-15 Thomas Heller <thellerpython.net>
* comtypes\__init__.py: Fix bound_named_property.__setitem__ so
that COM properties can be set that require zero or more than one
arguments.
* comtypes\__init__.py: Restructure the code that extend the COM
interface subclasses with __len__, __call__, __getitem__, and
__iter__ methods. This is done with the comtypes.partial module,
and apparently had strange behaviour when the code is run under a
debugger.
2007-11-07 Thomas Heller <thellerpython.net>
* Changed version number to 0.4.1.
* Add an post-install script that will (after confirmation) remove
the comtypes\gen directory containing the generated modules.
2007-11-02 Thomas Heller <thellerpython.net>
* Bump version number to 0.4.0.
Released version 0.4.0.
* In _wrap_coclass, attach a __clsid attribute to the returned
object. This allows, for example, to find outgoing interfaces when
a CoClass is returned from a COM method call.
2007-10-26 Thomas Heller <thellerpython.net>
* Implemented property get, put, and putref with arguments
in comtypes.client.dynamic.
* When a COM property has both propput and propputref accessor
methods, the Python property fset methods determines the type of
the argument.
If the argument is a COM interface pointer, or a VARIANT
containing one, then propputref is called, otherwise proput is
called to set the property.
* Allow the creation of SAFEARRAY(UDT) types even if the UDT has
no _recordinfo_. Creating instances of these types will fail
however since no IRecordInfo pointer can be created. This change
allows to import typelib wrappers that have UDTs without guids.
2007-10-24 Thomas Heller <thellerpython.net>
* When a COM property has a 'propputref' but no 'propput' accessor
method, use the former in the same way as a 'propput' would work.
When both 'propputref' and 'propput' are present, raise a
TypeError because we cannot handle this case for now.
* Fixed infinit recursion error in __getattr__ implementation.
* comtypes.dynamic._Dispatch now implements a __setattr__ methods
that will call to Invoke() with DISPATCH_PROPERTYPUT or
DISPATCH_PROPERTYPUTREF.
* Handle DISPATCH_PROPERTYPUTREF in IDispatch.Invoke
implementation.
* comtypes.dynamic._Dispatch objects can now be used as VARIANT
value.
2007-10-22 Thomas Heller <thellerpython.net>
* The repr of a COM pointer instance now includes the pointer
value for easier debugging.
2007-10-17 Thomas Heller <thellerpython.net>
* Disable the VT_UNKNOWN and VT_DISPATCH safearray codes, they do
not work yet.
* More multidimensional safearray tests, bug fixes.
* Speed up the unpacking of 1- and 2-dimensional safearrays.
* Lots of refatoring of the new SAFEARRAY code; added a docstring
to the public function comtypes.safearray._midlSAFEARRAY.
* For easier debugging, the repr of a VARIANT instance now
contains the vartype.
2007-10-16 Thomas Heller <thellerpython.net>
* Changed version number to 0.3.4.
* Mega-patch: Completely rewritten safearray support. SAFERARRAYs
are now automatically converted to Python tuples when they are
received as [out] parameters in COM methods, and sequences are
accepted as SAFEARRAY [in] parameters. Multidimensional safearray
support still has to be added.
* VARIANTs can now also contain SAFEARRAYs. VARIANTs containing
SAFEARRAYs with a typecode other than VT_VARIANT, Python
array.array instances can be used.
* Added a comtypes.messageloop module that contains a simple
messageloop which allows to add and remove custom filter functions.
* Removed the comtypes.client.PumpWaitingMessages function.
* Fixed the codegenerator so that it handles unnamed method
parameters.
2007-10-04 Thomas Heller <thellerpython.net>
* Several refactorings and a small bugfix from the upstream
repository.
* In the comtypes\gen\... type library wrappers, the code
generator now creates a commented out template that shows an
implementation for each interface it wraps.
2007-10-02 Thomas Heller <thellerpython.net>
* comtypes.safearray.UnpackSafeArray can now unpack SAFEARRAYs
that containt UDT (user defined data types). Patch by Rimon Barr,
testcase by me.
2007-09-14 Thomas Heller <thellerpython.net>
* Released version 0.3.3.
2007-09-12 Thomas Heller <thellerpython.net>
* Bump version number to 0.3.3.
2007-09-03 Thomas Heller <thellerpython.net>
* Add the partial module, which allows the usual class statement
syntax to attach methods to already existing classes.
* Use partial in comtypes.automation to attach methods to
POINTER(VARIANT).
2007-08-24 Thomas Heller <thellerpython.net>
* Added a custom outgoing interface to TestComServer.idl.
Implemented IConnectionPointContainer in TestComServer.py.
* comtypes.server.automation: Fix the IProvideClassInfo2.GetGUID
implementation.
* comtypes.client: Fix ShowEvents(): COM methods must return a
HRESULT value, not None. Fix several NameErrors in the
PumpWaitingMessages function.
2007-08-14 Thomas Heller <thellerpython.net>
* comtypes\tools\codegenerator.py: Generate the needed imports
when COM defaultvalues are used in parameter lists.
2007-08-10 Thomas Heller <thellerpython.net>
* Add comtypes.client.PumpWaitingMessages() helper funtion. May
be used to dispatch COM events in single threaded appartments.
2007-08-09 Thomas Heller <thellerpython.net>
* Added the IRecordInfo interface to comtypes.typeinfo.
* If UDTs (structures or unions) in a typelib have a GUID defined,
add a _recordinfo_ attribute to the generated code. This allows
to call GetRecordInfoFromGuids(*_recordinfo_) to get an
IRecordInfo pointer.