使用Python访问我的.dll文件 [英] Access my .dll file using Python
问题描述
我目前正计划使用Python访问基于MFC对话框的应用程序的.dll文件.我是Python的新手,并且安装了Python的最新版本,即3.2.我也安装了PythonWin,但不确定是否有用.我了解在ctypes的帮助下使用python的基本知识.在我的dll文件中,我有两个功能:
I am currently planning to access my MFC Dialog based application''s .dll file using Python. I am new to Python and have the latest version of Python installed i.e. 3.2. I have installed PythonWin as well, but not really sure if it would be useful or not. I have understood like the basics of using python with the help of ctypes. In my dll file, I have two functions:
double BoxArea(double L, double H, double W);
double BoxVolume(double L, double H, double W);
并且我已经使用extern dllimport命令在我的mfc对话框应用程序中访问这些文件.
and I have used the extern dllimport command to access these in my mfc dialog application.
extern "C" __declspec(dllexport)void BoxProperties(double Length, double Height,
double Width, double& Area, double& Volume);
尝试使用其他mfc程序进行访问时,一切正常.现在,我尝试使用Python访问这两个函数.谁能建议我该怎么办?什么命令可以直接让我访问它?
事先非常感谢.
All that works fine when trying to access with another mfc program. Now, I am trying to access those two functions using Python. Could anyone suggest me how should I go about and what commands would directly let me access it?
Many thanks in advance.
推荐答案
Google揭示了所有内容.
Python和MFC中的皮肤对话框 [
Google reveals all.
A skinned dialog in Python and MFC[^]
我自己并未使用Python,但我著名的Google技能取得了一些成果.
Google搜索"python call dll" [ 15.17. ctypes-Python的外部函数库 [ ^ ]
Haven''t used Python myself, yet my famous Google skills yielded some results.
Googling "python call dll"[^] and reading the first couple of hits seems to indicate ctypes is what you need.
15.17. ctypes - A foreign function library for Python[^]
这篇关于使用Python访问我的.dll文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!