声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1830|回复: 0

[C/C++] 请版主帮我看看程序如何修改

[复制链接]
发表于 2009-9-28 14:22 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x

一个编码器的数据采集程序,用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 <stdio.h>
// 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();
}




[ 本帖最后由 li343 于 2009-9-28 14:25 编辑 ]
回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-19 07:28 , Processed in 0.128927 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表