如何把vb的string类型数据传给vc动态库中的函数。
那位高手举个例子,vb传给vc函数一个string,在从此函数原样返回即可。

解决方案 »

  1.   

    这个C函数该怎么写?
    另,是否可以从VB向VC传递数组?
      

  2.   

    vb中的string 应该和vc中的_bstr是同一中类型. 
    你或者可以用VARIANT啊
      

  3.   

    VC中如下定义
    extern "C" short APIENTRY SmsSend(int Port,char *MobilePhone, char *Message); 在VB中
    Declare Function SmsSend Lib "SmsDll" (ByVal Port As Integer, ByVal MobilePhone As String, ByVal Message As String) As IntegerDim MobilePhone As String * 21
    Dim Message As String * 201
    Dim Port As Long
    Ret = SmsSend(Port, MobilePhone,Message)
    这是实际使用的程序,肯定没问题