24小时热门版块排行榜    

查看: 245  |  回复: 1
当前主题已经存档。

jiali2843

金虫 (正式写手)

[交流] 【求助】VC调用VB生成的dll出错,求助

错误信息:
Test.cpp
C:\Documents and Settings\Owner.LENOVO-52CEDA01\桌面\Test.cpp(23) : error C2664: 'readGAM60Value' : cannot convert parameter 1 from 'char [9]' to 'unsigned short ** '
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.

VB生成的dll见附件

程序代码:
#include
// This is the path for your DLL.
// Make sure that you specify the exact path.

#import "d:\project1.dll"  no_namespace

void main()
{
BSTR bstrDesc;
         try
{
CoInitialize(NULL);
        // Declare the Interface Pointer for your Visual Basic object. here,
        // _Class1Ptr is the Smart pointer wrapper class representing the
        // default interface of the Visual Basic object.

        _Class1Ptr ptr;
        // Create an instance of your Visual Basic object, here
        // __uuidof(Class1) gets the CLSID of your Visual Basic object.

        ptr.CreateInstance(__uuidof(Class1));
        double jiaodu =ptr->readGAM60Value("2330300D";
      }
      catch(_com_error &e)
      {
bstrDesc = e.Description();
      }
      CoUninitialize();
}

[ Last edited by jiali2843 on 2009-9-28 at 09:28 ]
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

jjdg

版主 (知名作家)

优秀版主

★ ★ ★ ★ ★ ★ ★ ★ ★ ★
jiali2843(金币+1):谢谢参与
jiali2843(金币+9,VIP+0):非常感谢你帮我修改程序! 10-3 23:25
你的参数是怎么传的?
看你这个函数的名字和li老兄的名字都是一样的,你可以试试直接做没有窗体的exe自动获取参数并保存于一制定文件中,然后在c里面设定一个按钮事件去对那个文件进行操作即可!

[ Last edited by jjdg on 2009-10-4 at 11:43 ]
努力学习!以正当途径!获得需要的知识!
2楼2009-10-02 00:15:28
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 jiali2843 的主题更新
普通表情 高级回复 (可上传附件)
信息提示
请填处理意见