大侠们,ATL里这样用,竟然不行?????

explosun 2003-10-16 10:25:39
声明[id(13), helpstring("method test")] HRESULT test(BSTR *str);
test(BSTR *str)
{
_bstr_t a;
a="hello";
*str=a.copy();
return S_OK;
}
客户端VB
Form.load()
Dim a As New Org
Dim str As String
str = "hi"
a.test (str)
MsgBox str
我想我这样用应该没错吧,可是还是不能把传入的变量改为HELLO,请问这是怎么回事????
...全文
30 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
XXandOO 2003-10-18
  • 打赏
  • 举报
回复
除了上边说的,
*str=a.copy();---[out]参数不能这样写

最好这样写
CComBSTR combstr;
combstr = Attach(a);
str = SysAllocString(combstr);
warmchang 2003-10-18
  • 打赏
  • 举报
回复
[in, out]!
Darkay_Lee 2003-10-18
  • 打赏
  • 举报
回复
就是这个[out]
shudingbo 2003-10-18
  • 打赏
  • 举报
回复
同上!
Analyst 2003-10-17
  • 打赏
  • 举报
回复
声明[id(13), helpstring("method test")] HRESULT test([in, out]BSTR *str);
DragonFly-9 2003-10-17
  • 打赏
  • 举报
回复
声明[id(13), helpstring("method test")] HRESULT test([out,retval]BSTR *str);
test(BSTR *str)
{
*str=L"hello";
return S_OK;
}
honghaozi 2003-10-16
  • 打赏
  • 举报
回复
在定义前加上[in,out]
explosun 2003-10-16
  • 打赏
  • 举报
回复
为什么没有回答我的问题,我自己UP
RAD Studio 10.2 Toyko Update2 10.2.2 KEYGEN 一键激活,安装时选择试用,安装完毕后一键激活即可。亲测可用!! Win10 Build 16299 旗舰版 亲测可用!!! 为了便于在 Lite 14.x 中使用大侠们的特别补丁,初步写成这个:Activator.exe 他的主要作用: 1、整合 elseif、unis、x-force、cjack 大虾的 Keygen 相对原始部署方式,这个 Activator 实现“一键激活”! 使用方法: 1、执行 Activator.exe 发布历史: 2017.12.14 - v14.2 1、根据 25.0.28979.1978 原版制作,基于 RadStudioKeygenSourceCodeTokyo10.2Update2CorrectedSetup.zip 的成果 2017.08.11 - v14.1 1、根据 25.0.27659.1188 原版制作,基于 elseif-Rad-Studio-Keygen-master upto 10.2.1 的成果 2017.03.26 - v14.0 1、根据 25.0.26309.314 原版制作,基于 elseif、unis、x-force、cjack 等大虾的成果 已知问题: 1、在一些操作系统上如果出现安全提示,直接确定即可。 特别感谢: 1、elseif、unis、x-force、cjack、crackerjack、dr、freecat、gateway、huayan889、kerlingen、sinner、yuto 等大侠的特别补丁,感谢诸位我知道的不知道的的大虾们的辛勤劳动! 2、iny、nevergrief、snakejiao、star5、tintin1943、ti9er、wang_80919、wuxiangyang 等等我知道的不知道的的网友们的热情测试! 3、andreas hausladen 等大虾们的无私贡献! O(∩_∩)O~ Delphi 10.2 and C++Builder 10.2 Updata2 亲测可用! Embarcadero® C++Builder 10.2 Version 25.0.28979.1978 Copyright © 2017 Embarcadero Technologies, Inc. All Rights Reserved. advapi32.dll, 10.0.16299.15, C:\WINDOWS\System32\ AEPIC.dll, 10.0.16299.15, C:\WINDOWS\SYSTEM32\ androiddebugide250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\studio\19.0\Bin\ appanalytics250.bpl, 25.0.28979.1978, D:\Program Files (x86)\Embarcadero\Studio\19.0\bin\ apphelp.dll, 10.0.16299.98, C:\WINDOWS\SYSTEM32\ applet250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\studio\19.0\bin\ asmview250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\studio\19.0\Bin\ ATL.DLL, 3.5.2284.0, C:\Windows\System32\ bcbandroid250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\studio\19.0\Bin\ bcbcoment250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\studio\19.0\Bin\ bcbcompro250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\studio\19.0\Bin\ bcbent250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\studio\19.0\Bin\ bcbfmxide250.bpl, 25.0.28979.1978, d:\program files (x86)\embarcadero\s

3,245

社区成员

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

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