注册大漠插件
安装 pypiwin32
库
import os
import win32com.client
os.system("regsvr32 D:/dm.dll /s")
dm = win32com.client.Dispatch("dm.dmsoft")
print(dm.ver())
要使用 32 位的 Python!!!
免注册大漠插件
研究了很久不成功,存档······
import ctypes
from comtypes.client import CreateObject
dms = ctypes.windll.LoadLibrary(r'DmReg.dll')
dms.SetDllPathW(r'dm.dll', 0)
dm = CreateObject('dm.dmsoft')
print(dm.Ver())
没用
解决没~
from ctypes import WinDLL
from win32com.client import Dispatch
import os
G_sGlobalPath = os.getcwd()
print(G_sGlobalPath)
dll = WinDLL(G_sGlobalPath + '\DmReg.dll')
dll.SetDllPathW(G_sGlobalPath + '\dm.dll', 0)
dm = Dispatch('dm.dmsoft')
dm_Ver = dm.Ver()
print(dm_Ver)
这代码可用, 免注册文件和dm主体放在和pycharm 文件同一个文件夹里,