首页 > 解决方案 > 从 64 位 Python 访问 32 位 DLL 文件 - Ctypes 和 msl.loadlib 不起作用?

问题描述

我正在尝试使用 64 位 Python 访问 32 位 DLL 文件,但它不起作用?

我尝试了 Ctypes 和 msl.loadlib 模块,但它们没有帮助我吗?

I get the error not a valid 32bit application ? When i try Cpp64() i get 
UnsupportedOperation: fileno

这是我在 excel 中的 VBA 代码

Private Declare Function UTLConnectSession Lib "ATMAPI32.DLL" (ByVal hWnd&, ByVal Session$) As Long

它运作良好。当尝试在 python 中访问相同的内容时,它不会

import ctypes
from ctypes import *
import os
import sys

myDll = ctypes.CDLL(r"C:\Program Files (x86)\IBM\EHLLAPI\atmapi32.dll")
print(myDll)

from msl.loadlib import LoadLibrary, IS_PYTHON_64BIT
from msl.examples.loadlib import EXAMPLES_DIR
from msl.examples.loadlib import Cpp64

cdir=r"C:\Program Files (x86)\IBM\EHLLAPI\atmapi32.dll"
Cpp64()

我如何让它在 python 中工作?

问候,任。

标签: python-3.xdllctypes

解决方案


推荐阅读