I have written a python script to use our COM Component in Python. I learned basic Python syntax for our client. I have used Python 2.7.10(32bit) version on Windows 8.1(64bit). I have added the extension comtypes to Python installation which supports Python 32 bit. That’s why I had to create our 32bit Automation server component. This extension allows us to support COM components. I have tested the Python Script and working good. 🙂 Please find the attached script file.
It took 2 days to work around this and for Java script client(did not get success). I have also tried C client. It’s very good. I feel, it actually gives us a idea about how CPP’s class must be written in C(header file for C client is highly noteworthy) and also gives clear idea about virtual function table, its actual use via lpvtbl pointer.
As you said, C# does not use our IDispatch but directly calls those two methods via custom interface, I had put message boxes in the IDispatch’s functions and observed the same behavior. In case of VB client, it uses our IDispatch. In case of Python client, I observed that it is not using IDispatch but directly calls CoCreateInstance for our provided interface(here it’s IMyMath). It uses our registered type library. We can easily call QI in Python client to get desired interface pointer.
References:
1) Download Python 2.7.10(32bit)
2) Download comtypes extension
3) comtypes documentation
4) Python Client help on codeproject
Our sessions on why Java/.NET came and now why WinRT introduced, were really good. I enjoyed them and we got the clear idea “How should we start learning a technology and How it should be taught”. Thank you.
Note: Rename PythonClient to .py
Steps and Program By: Jeevan Gaikwad (UNIX 2014, WinRT 2015, RTR 2017)