[python-win32] Using COM DLL

Christiaan B v Zyl christiaanvanzyl at gmail.com
Tue Aug 12 13:28:00 CEST 2014


I have a DLL, it is an SDK for the Pastel Partner accounting system. Using
Dependency Walker I can see that the DLL has the following methods:
DllRegisterServer, DllUnregisterServer, DllGetClassObject

With the library there came a sample VB program that referenced the DLL and
instantiated it like this:
Dim SDK As New PasSDK.PastelPartnerSDK

The only way I've been able to use this library from python is to register
it with Windows:
regsvr32 PasSDK.dll

And then use it in python like this:
import win32com.client
sdk = win32com.client.Dispatch(PasSDK.PastelPartnerSDK")
sdk.SetLicense(...)
etc...

However, is there a way to use this library directly without registering it
first? Something like:
from ctypes import *
sdk = cdll.LoadLibrary('PasSDK.dll')

When I do this I can see that sdk.DllGetClassObject is a function, but how
do I instantiate it like the VB program, is it possible?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20140812/8e7fac11/attachment.html>


More information about the python-win32 mailing list