semvec/pypi-packages huggingface dataset:
imessagefilter 0.2.1
A python package implements interface IMessageFilter for COM
Keywords: COM IMessageFilter

=================
 IMessageFilter
=================

A python package implements interface IMessageFilter for COM.

The main purpose is to fix 'Application is Busy' and 'Call was Rejected By Callee' errors in a WINDOWS COM/COM+ client.

Here is a workaround

https://docs.microsoft.com/en-us/previous-versions/ms228772(v=vs.140)

But it's written by C#, this package offers both C and Python versions.

Usage
-----

Install it::

  pip install imessagefilter

Import `CMessageFilter` from `imessagefilter`

Call static method `register` at the beginning of automation

Call static method `revoke` at the end of work

Here it's an example:

.. code:: python

    from comtypes.client import CreateObject
    from imessagefilter import CMessageFilter

    def iter_excel_sheets(filename):
        CMessageFilter.register()
        aobj = CreateObject('Excel.Application', dynamic=True)
        aobj.Workbooks.Open(filename)
        for sheet in aobj.ActiveWorkbook.Worksheets:
            print('Processing %s' % sheet.Name)
        CMessageFilter.revoke()


.. note::

   The interface `IMessageFilter` only works in single-threaded
   apartments, it will not be called in the multithreaded
   apartments.

   Refer to
   https://docs.microsoft.com/en-us/windows/desktop/com/choosing-the-threading-model

Build `msgfilter.dll`
---------------------

By visual studio command line::

    cl /LD msgfilter.c ole32.lib

By mingw32 in cygwin::

    i686-pc-mingw32-gcc -shared -o msgfilter.dll msgfilter.c -lole32 -luuid

There are 2 export functions, they can be used in any c file.

Here it's an exmaple:

.. code:: c

    #include <stdio.h>
    #include <objbase.h>

    extern void register_message_filter();
    extern void revoke_message_filter();

    int main(int argc, char* argv[])
    {
      HRESULT ret;
      ret = CoInitializeEx(0, COINIT_APARTMENTTHREADED);
      register_message_filter();

      // do something for automation

      revoke_message_filter();
      CoUninitialize();

      return 0;
    }

Change Logs
-----------

0.2.1
~~~~~
* Search msgfilter.dll in the current path first

0.1.3
~~~~~
* Fix no long description in package information

0.1.2
~~~~~
* Fix typos
smgen 0.0.4
Code generator to create state machine

<p align="center">
  <img width="250" src="LOGO">
</p>

<h1 align="center"> State Machine code generator </h1>
<p align="center">
  <b> Code generator to create a state machine </b>
</p>
<br>

[![GitHub release](https://img.shields.io/github/release/hellstein/statemachine.svg)](https://github.com/hellstein/statemachine/releases)
![Github All Releases](https://img.shields.io/github/downloads/hellstein/statemachine/total.svg)
![Travis (.org) branch](https://img.shields.io/travis/hellstein/statemachine/BRANCH.svg)
![GitHub](https://img.shields.io/github/license/hellstein/statemachine.svg)

# How to use 
Please check the [github page](https://hellstein.github.io/statemachine) for this project.

# How to contribute
* Please check the [github page](https://hellstein.github.io/statemachine) for this project.
* Join the [gitter](https://gitter.im/hellstein/community)

# Logistics
### Code of conduct
For details on our [code of conduct](https://github.com/hellstein/statemachine/blob/master/.github/CODE_OF_CONDUCT.md), and the process for submitting pull requests to us.
### Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the tags on this repository
### Authors
* **dorrywhale** - *Initial work* - [dorrywhale](https://github.com/dorrywhale)
* See also the list of [contributors](https://github.com/hellstein/statemachine/graphs/contributors) who participated in this project.
### Acknowledgments
See [Acknowledgments](https://github.com/hellstein/statemachine/blob/master/.github/ACKNOWLEDGMENTS.md)
### License
This project is licensed under the MIT License - see the [LICENSE.md](https://github.com/hellstein/statemachine/blob/master/LICENSE.md) file for details