Skip to main content

Introduction

AxServe is a server program and client interface that provides functionalities of COM or OCX components through a gRPC server.

Motivation

There are many ways to integrate COM or OCX components, such as creating native apps or using other libraries or frameworks. But they all have their own strengths and weaknesses.

Options that I had considered so far were:

Library Module Based On Maintainer Language
Win32     Microsoft C/C++
MFC     Microsoft C++
Qt5 ActiveQt Win32 Qt Group C++
Qt6 ActiveQt Win32 Qt Group C++
pywin32 win32com.client Win32 Mark Hammond Python
pywin32 pywin.mfc.activex MFC Mark Hammond Python
PyQt5 PyQt5.QAxContainer Qt5 Riverbank Computing Python
PyQt6 PyQt6.QAxContainer Qt6 Riverbank Computing Python
PySide2 PySide2.QtAxContainer Qt5 Qt Group Python
PySide6 PySide6.QtAxContainer Qt6 Qt Group Python

And Pros & Cons of each of these options that I had experienced while using some of them were as follows:

  • Requires build step
    • (-) C/C++ Language options require build step
    • (+) Python Language options do not require built step
  • Complexity in dependency resolution and installation
    • (-) Python Language options may have no proper python version that supports all requirements like target architecture (x86/x64) and version support (3.x)
    • (-) And Python Language options may require multiple python installations with some IPC (Inter-Process Communication) technique as workaround
    • (+) C/C++ Language options only require single installation for each target architecture once built
    • (-) But C/C++ Language options may have hard time in managing it's dependencies compared to python when it comes to installation and building
  • Size of dependencies
    • (+) Microsoft Maintainer options require no further dependencies
    • (-) Other libraries and frameworks based options may require large amount of dependencies which might complicate things
  • Ease of use, amount of learning materials and references, quality of documentation
    • (+) Qt based Python bindings options are easy to use, have lots of materials and references
    • (+) Qt based options have good documentation and sufficient references
    • (-) Other options may have less materials, might be harder to use
    • (+) Python Language options are generally considered as easy compared to C++
  • Possibility of being deprecated or obsolete
    • (-) Qt5 Based options will become deprecated/obsolete over time in favor of Qt6
    • (+) Qt6 based options are latest version in Qt
  • 32bit architecture support
    • (+) Qt5 Based options support 32bit architecture on windows naturally with prebuilt binaries (link)
    • (-) Qt6 Based options do not provide prebuilt binaries for 32bit architecture on windows (link)
  • Applicability of acquired knowledge across domains
    • (+) Qt based options can leverage learned skills to create other applications for platforms other than windows
    • (-) Other options may be too platform specific
  • License
    • (-) PyQt Based options require GPLv3 license, unless commercial license is used
    • (+) Qt Group Maintainer options (QtX and PySideX) require LGPLv3 license
    • (+) Pywin32 based options generally considered as PSF-2.0 (issue)
    • (+) Microsoft Maintainer options have less license implications

My personal goal was to use 32bit COM/OCX feature in python. So based on the analysis and my goal, my final decision was:

  • Not to bring the COM/OCX part of dependency to the python side
  • But make the dependency loose by supporting the functionality using an IPC technique with some libraries like gRPC
  • Learn Qt6 and use that for development
  • Build Qt6 for 32bit architecture support on my own
  • Build single server executable and use that in python
  • More specifically, run the server executable using subprocess and connect to that using grpcio

And this project is the outcome of those choices.

Usage

Server

GUI

  1. Run the executable by double clicking.
  2. Type the required information.
    • CLSID required to instantiate an Active-X or COM object.
    • Address URI for gRPC server to bind.
  3. Press start button to start server.

axserve

Console

If built with console support, give required options to run the server as cli argument:

.\axserve-x86-console-debug.exe --clsid="{A1574A0D-6BFA-4BD7-9020-DED88711818D}" --address="localhost:8080" --no-gui

That --no-gui option makes the application run without GUI components. This can be useful for cases like embedding this executable in other things. FYI, technically it's not a pure non-gui application but just tries to hide or not to show the windows created internally.

The GUI version also accepts the same cli arguments. But note that it cannot print any messages since there is no console attached. FYI, the GUI version uses message boxes for that instead when needed (like printing errors).

Client

Just started working on a Python client.

Check the following codes for more information, until relevant documentations are added:

Building

Install Tools for Building Project

Install MSVC BuildTools

https://learn.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?view=vs-2022

vs_buildtools.exe
    --add "Microsoft.VisualStudio.Workload.VCTools"
    --add "Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
    --add "Microsoft.VisualStudio.Component.VC.CMake.Project"
    --add "Microsoft.VisualStudio.Component.VC.ATL"
    --add "Microsoft.VisualStudio.Component.VC.ATLMFC"
    --includeRecommended
    --passive
    --norestart

Install Chocolatey

https://chocolatey.org/install

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Install GIt

https://git-scm.com/

choco install git.install

Install NASM

https://www.nasm.us/

choco install nasm

Install Python

https://www.python.org/

choco install python311

Install CMake

https://cmake.org/

choco install cmake

Install Ninja

https://ninja-build.org/

choco install ninja

Build Project using CMake

List Configure Presets

cmake --list-presets

Configure

cmake --preset amd64

Build

cmake --build --preset amd64-release

Note that you should build ${host_arch}-release version first in order to support the tools for the later cross-compling.

Build Project using Hatch and publish

Build Project for Python client package

hatch build

Publish to PyPI

hatch publish

Metadata

Release files for axserve 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for axserve 0.2.0
File Size Uploaded
axserve-0.2.0.tar.gz 88.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for axserve 0.2.0
File Interpreter ABI Platform
axserve-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.6 MB

Release files / axserve-0.2.0.tar.gz

Download URL axserve-0.2.0.tar.gz
Size 88.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9c77fec64e07ac5596c1559605ebcb0d5b9c39958b791ce22506aa81ba407199
BLAKE2b-256 checksum
How to use checksums
e89c821158b336c42001fa779a2f69725a771cecd95d246551d472ae9bb943c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release files / axserve-0.2.0-py3-none-any.whl

Download URL axserve-0.2.0-py3-none-any.whl
Size 51.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
1962673f6fbc085b4b8d9e318d2b46dc759272140040c5a5ce62cdb24c34612a
BLAKE2b-256 checksum
How to use checksums
4f1ca95f7d824b1b6dedd234a6c81707dbd61acaa1af64112d9af7f3d42df49f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page