开发者

Using an MFC .dll file with Python 3.2

开发者 https://www.devze.com 2023-04-03 17:03 出处:网络
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

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(d开发者_运维问答ouble L, double H, double W);

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);

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.


I think this should give you some idea on what you are trying to do. Hope this helps.


MFC isn't just a library, it's a platform. It's going to depend on certain assumptions, such as proper initialization being done at program startup and that an MFC message pump will be called periodically among others. Those assumptions will not be met by Python and it will be impractical to make it work properly.

It is possible to program a DLL so that it uses MFC internally but is completely self-contained, but I'm guessing yours is not. See http://msdn.microsoft.com/en-us/library/30c674tx(v=vs.90).aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号