在Python中访问MFC函数
我最近刚刚开始使用 python 将其与我的 mfc 程序一起使用,到目前为止这是一个不错的旅程。目前,我正在尝试从我的 mfc dll 程序访问一个函数,其格式如下:
void DLLDIR DrawEllipse ( CRect, CDC* );
我已经使用了 extern“C” 和所有内容,并且我能够访问该函数。在声明其restype和argument类型方面,我目前面临一些问题。显然,restype 将为“None”,但我无法理解如何声明其争论类型,即 CRect 和 CDC*。如果有人已经知道如何访问 MFC 函数,那就太好了并将它们用作 python 函数中的参数。
提前致谢。
I have just recently started using python for using it with my mfc program and it has been a decent journey so far. At the moment, I am trying to access a function from my mfc dll program that has a format given below:
void DLLDIR DrawEllipse ( CRect, CDC* );
I have used extern "C" and everything and I am able to access the function. In terms of declaring its restype and arguement type, I am facing some problems at the moment. Obviously the restype would be "None" but I am unable to understand as to how do I declare its arguement type which are CRect and CDC*.Would be great if someone already knows how to access the MFC functions and use them as arguements in your python functions.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能,你需要将这些结构包装为 Python 对象 - 要么让你自己拥有,要么使用矩形的“本机”Python 等效项(如果有的话,我不知道有哪个)。查看 Python win32 包(例如 win32all)来完成繁重的工作,这样您就不必自己重新实现它。
You can't, you need to wrap those structures as Python objects - either make you own, or use the 'native' Python equivalent of a rectangle (if there is one, I don't know of any). Look at Python win32 packages such as win32all to do the heavy lifting, so that you won't have to re-implement it all yourself.