sounds like type mismatch
解决方案 »
- mfc问题
- vs2010 MSDN 终于可以有索引了,不必再使用浏览器查看了
- glewInit()函数调用失败怎么办?
- 第一次非亲密接触ActiveX
- 小白问题_endthreadex()怎么用?
- 大散分來者有份,大家都來支持珊珊……
- 求《com编程精彩实例》光盘源码
- 我有某厂商提供的inf文件,如何通过编程调用inf文件实现驱动的安装?
- VC+OpenGL程序中如何使用多个设备环境??
- 关于 WM_GETTEXT 与 WM_SETTEXT 的一些小问题
- VFB的DBF和foxpro for dos、foxbase、dbase等的格式是否是一样的?
- 最近本人正在开发一个关于IC卡的读写程序,各位对这个感兴趣吗?
另外返回值最好是改成Long型。
COM的许多错误情况不同代码可能一样,所以需要具体的上下文或运行环境才知道。
有人遇到过这个问题么.
我的系统是Win2000
Vb是SP5的
是不是安装COM+的时候出了这个问题呢?
2。你所说的EXE是用VB还是VC写的?
3。能否把你出错的那个方法的IDL原型生明post 一下(你可以用OLEVIEW.exe打开)
4。ASP中的对应调用代码微软亚洲技术中心 VC技术支持本贴子仅供CSDN的用户作为参考信息使用。其内容不具备任何法律保障。您需要考虑到并承担使用此信息可能带来的风险。具体事项可参见使用条款 (http://www.csdn.net/microsoft/terms.shtm)。
我的DLL是在COM+里面的
EXE文件也是用VB写的
..........................................................
// Generated .IDL file (by the OLE/COM Object Viewer)
//
// typelib filename: CDes.dll[
uuid(687DAFDB-2D48-415A-90FE-213F80B7E574),
version(2.0)
]
library CDes
{
// TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
importlib("stdole2.tlb"); // Forward declare all types defined in this typelib
interface _clsDes; [
odl,
uuid(85B07E55-A089-4395-BD6B-86D0B9D7C63E),
version(1.0),
hidden,
dual,
nonextensible,
oleautomation
]
interface _clsDes : IDispatch {
[id(0x60030008)]
HRESULT Str2Bytes(
[in, out] BSTR* tStr,
[in, out] SAFEARRAY(unsigned char)* tByt);
[id(0x60030009)]
HRESULT Bytes2Str(
[in, out] SAFEARRAY(unsigned char)* tByt,
[in, out] BSTR* tStr,
[in, out] short* bytlen);
[id(0x6003000a)]
HRESULT Asc2Hex(
[in, out] BSTR* tStr,
[in, out] SAFEARRAY(unsigned char)* HexArray,
[in, out] short* AscLen);
[id(0x6003000b)]
HRESULT Hex2Asc(
[in, out] SAFEARRAY(unsigned char)* HexArray,
[in, out] SAFEARRAY(unsigned char)* AscArray,
[in, out] short* HexLen);
[id(0x6003000c)]
HRESULT Asc2Bcd(
[in] BSTR tAsc,
[in, out] BSTR* tBcd);
[id(0x6003000d)]
HRESULT Bcd2Asc(
[in] BSTR tBcd,
[in, out] BSTR* tAsc);
[id(0x60030012)]
HRESULT Encrypt(
[in, out] BSTR* tText,
[in, out] BSTR* tKey,
[in, out] BSTR* tSecretText,
[out, retval] long* );
[id(0x60030013)]
HRESULT Decrypt(
[in, out] BSTR* tSecretText,
[in, out] BSTR* tKey,
[in, out] BSTR* tText,
[out, retval] long* );
}; [
uuid(57354071-914A-4BBF-8C48-5D9F7420D9E3),
version(1.0)
]
coclass clsDes {
[default] interface _clsDes;
};
};
............................................................
<% @Language = "VBScript" %>
<html>
<head>
<title>DES 测试</title>
</head>
<body>
<%
Dim sData
Dim dData
Dim objDes
dim key
Set objDes=Server.CreateObject("CDes.clsDes")
dim src
src="0123456789ABCDEF"
key="0123456789ABCDEF"
if objDes.Encrypt(src, key, dData)=1 then
Response.Write dDada
if objDes.Decrypt(dData,"0123456789ABCDEF",sData)=1 then
Response.Write sData
else
Response.Write "Error Decrypt"
end if
else
Response.Write "Error Encrypt"
end if
set objEclient=nothing%>
<b>
DES 算法测试程序
</b>
</body>
</html>
..........................................................
不是很明白你的意思?用了2个多小时的debug跟踪才发现这个问题实际上跟具体的runtime实现有关--你碰到的是VBScript引擎的限制。如果你的客户端为VBScript,那么当有多个out参数的时候,你需要使用VARAINT数据类型,问题自然就解决了:
(注:这种限制只对VBScript引擎。在我的测试中VB和JScript中没发现有这个限制,也就是说你原来的方法生明在VB and JScript中调用是成功的。)修改后的方法生明:
[id(0x60030012)]
HRESULT Encrypt(
[in] BSTR tText,
[in] BSTR tKey,
[in, out] VARIANT* tSecretText,
[out, retval]VARIANT* );
另外不是很清楚你为什么要把这个组件放到COM+中,听你的描述好像没有这个必要。微软亚洲技术中心 VC技术支持本贴子仅供CSDN的用户作为参考信息使用。其内容不具备任何法律保障。您需要考虑到并承担使用此信息可能带来的风险。具体事项可参见使用条款 (http://www.csdn.net/microsoft/terms.shtm)。
多谢