从MFC传递2D CString数组到python [英] pass 2D CString array from MFC to python

查看:334
本文介绍了从MFC传递2D CString数组到python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将二维CString数组从MFC传递给python

how to pass two dimensional CString array from MFC to python

推荐答案

CString是一个c ++类,它非常特定于MFC框架(对于ATL, nitpicks).因此,您不能在MFC之外发送CString(甚至不能发送到香草C ++).好吧,从技术上讲您可以发送它,但是收件人将无法对其进行任何处理.

但是,CString确实具有 AllocSysString() [ ^ ]成员该函数将分配与自动化兼容的BSTR类型字符串.该API将CString对象的内容复制到此BSTR中并返回.
CString is a c++ class that is rather specific to the MFC framework (and to ATL, for the nitpicks). Therefore, you cannot send a CString outside of MFC (not even to vanilla C++). Well, technically you can send it, but the recipient will not be able to make any sense out of it.

However, CString does have an AllocSysString()[^] member function that will allocate an automation compatible BSTR type string. The API copies the contents of your CString object into this BSTR and returns it.


由于您要将信息从C ++传递给python,因此您可能需要查看Boost.Python [
Since you want to pass information from C++ to python you may want to take a look at Boost.Python[^], a C++ library which enables seamless interoperability between C++ and the Python programming language.

Best regards
Espen Harlinn


这篇关于从MFC传递2D CString数组到python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆