调用VB编的COM组件的问题

superzxf 2003-10-10 09:40:53
有一个VB COM组件中的函数(其他带简单参数的函数都没有问题!)
Public Function Login(Optional wincap As String = "Welcom", Optional subsystem As String = "GL", Optional isstraight As Boolean = False, Optional acctid As Long) As Boolean

在VC中调用老是非法操作,是不是调用参数的传递有问题

a.Login((BSTR *)"",(BSTR*)"",false,0)
...全文
30 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
superzxf 2003-10-17
  • 打赏
  • 举报
回复
error C2065: 'CComBSTR' : undeclared identifier
我要死了
双杯献酒 2003-10-14
  • 打赏
  • 举报
回复
GZ
superzxf 2003-10-14
  • 打赏
  • 举报
回复
还是有错误啊:
cannot convert parameter 1 from 'class _bstr_t' to 'unsigned short ** '
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Analyst 2003-10-14
  • 打赏
  • 举报
回复
CComBSTR str1(L"xxx");
CComBSTR str2(L"xxx");
BOOL isstraight = FALSE;
long acctid = 0;
a.Login(&str1, &str2, &isstraight, &acctid);
superzxf 2003-10-14
  • 打赏
  • 举报
回复
还是一样有错误啊:
error C2664: 'Login' : cannot convert parameter 1 from 'unsigned short [1]' to 'unsigned short ** '
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

VC中显示的对应声明是:
BOOL Login(BSTR* wincap, BSTR* subsystem, BOOL* isstraight, long* acctid);
Analyst 2003-10-14
  • 打赏
  • 举报
回复
a.Login(&L"",&L"",false,0);
Analyst 2003-10-10
  • 打赏
  • 举报
回复
a.Login(L"",L"",false,0);
xiaohyy 2003-10-10
  • 打赏
  • 举报
回复
在options->directories中的include file中加入
安装路径\Microsoft Visual Studio\VC98\INCLUDE
superzxf 2003-10-10
  • 打赏
  • 举报
回复
又有错误:
error C2065: '_bstr_t' : undeclared identifier
xiaohyy 2003-10-10
  • 打赏
  • 举报
回复
a.Login(_bstr_t(""),_bstr_t(""),false,0)
superzxf 2003-10-10
  • 打赏
  • 举报
回复
发生错误:
error C2664: 'Login' : cannot convert parameter 1 from 'unsigned short [1]' to 'unsigned short ** '
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

怎么办啊!!

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧