如何从C / C ++的dll的字符串数组传递给VBA(EXCEL) [英] how to pass string array from C/C++ dll to vba (Excel)

查看:519
本文介绍了如何从C / C ++的dll的字符串数组传递给VBA(EXCEL)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从C / C ++ DLL传递字符串数组VBA(EXCEL)

how to pass string array from C/C++ dll to vba (Excel)

DLL在Visual Studio

dll in Visual Studio

DLL不是管理,ATL等。

dll is not managed, ATL, etc.

问候
刘德华

推荐答案

一来处理,这是写你的DLL返回类型字节作为函数结果的SAFEARRAY(VB数组是OLE SAFEARRAYS)的方式。

One of the ways to handle this is to write your DLL to return a SAFEARRAY of type Byte as the function result (VB arrays are OLE SafeArrays).

要做到这一点,你必须对安全数组的API和结构念起来。我不知道它自己,但你需要的主要事情是SAFEARRAYBOUND结构和SafeArrayCreate API。什么API返回给你,你回到VBA。而且你会做。

To do this you have to read up on the SafeArray APIs and structures. I don't know of it myself, but the main things you'll need are the SAFEARRAYBOUND structure and the SafeArrayCreate API. What the API returns to you, you return to VBA. And you'll be done.

这篇关于如何从C / C ++的dll的字符串数组传递给VBA(EXCEL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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