C ++和集合 [英] C++ and collections

查看:97
本文介绍了C ++和集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好


我正在将一个C ++程序与一个VB程序接口,我试图确定如何在我的c ++程序中正确定义该集合。我用
使用导入功能导入我接口的dll的功能,当我查看创建的tli文件时

在编译期间我看到以下内容

inline _IMSUsersPtr _cIMSBch :: GetIMSUsers(VARIANT_BOOL UserGroups)

{

struct _IMSUsers * _result = 0;

HRESULT _hr = raw_GetIMSUsers(UserGroups,& _result);

if(FAILED(_hr))_ com_issue_errorex(_hr,this,__ uuidof(this));

返回_IMSUsersPtr(_result,false);


_cIMSBchPtr ptrIMSBch(__ uuidof(cIMSBch));


ptrIMSBch- > GetIMSUsers(FALSE);

我做上面的声明并且它编译但是在这一点上它没有

有问题,因为我没有数据类型设置返回

集合进入


我想要的是以下内容


usercollection = ptrIMSBch-> ; GetIMSUsers(FALSE);


但我不喜欢不知道如何定义usercollection - 从我可以告诉

返回值定义是一个


struct _IMSUsers *< ---这是否意味着那个C ++看到这个集合

作为一个结构的ptr?


我尝试了不同的东西但没有提出解决方案


其中一个是


_IMSUsersPtr ptrIMSUsersPtr(__ uuidof(IMSUsers));


ptrIMSUsersPtr = ptrIMSBch-> GetIMSUsers(FALSE);


这个编译但在运行时会进入lala land


struct usercollection * collectuser


collectuser = ptrIMSBch-> GetIMSUsers(FALSE); - 不编译


(ptrIMSUsersPtr)collectuser = ptrIMSBch-> GetIMSUsers(FALSE); - 确实

不能编译


有人可以帮忙吗?我有点困惑。


最终我们将有一个函数返回几个非b / b
相关的数据类型以及一个集合。但是我的界面中永远不会使用这个集合

,但是我与

接口的dll需要将该集合作为需要返回的东西,因为

其他未来的接口可能需要使用该集合。这个

对我来说似乎很奇怪,要求定义一些没用过的东西

直接但是恰好是这样的情况所以我给了

需要确保正确定义集合,以便

它可以保存返回的数据。


有什么想法?


谢谢

杰克

Hello

I am interfacing a C++ program with a VB program and I am trying to
determine how to properly define the collection in my c++ program. I
am using the import function to import the functions of the dll that I
am interfacing with and when I look at the tli file that is created
during the compile I see the following
inline _IMSUsersPtr _cIMSBch::GetIMSUsers ( VARIANT_BOOL UserGroups )
{
struct _IMSUsers * _result = 0;
HRESULT _hr = raw_GetIMSUsers(UserGroups, &_result);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _IMSUsersPtr(_result, false);

_cIMSBchPtr ptrIMSBch(__uuidof(cIMSBch));

ptrIMSBch->GetIMSUsers(FALSE);
I do above statement and it compiles but at this point it does not
have a problem because I don''t have a datatype setup to return the
collection into

What I want is something like the following

usercollection = ptrIMSBch->GetIMSUsers(FALSE);

but I don''t know how to define usercollection - From what I can tell
the return value definition is a

struct _IMSUsers * <---Does this mean that C++ sees the collection
as a ptr to a structure?

I have tried different things but have not come up with a solution

one of which was

_IMSUsersPtr ptrIMSUsersPtr(__uuidof(IMSUsers));

ptrIMSUsersPtr = ptrIMSBch->GetIMSUsers(FALSE);

This compiles but goes off into lala land when it runs

struct usercollection *collectuser

collectuser = ptrIMSBch->GetIMSUsers(FALSE); - does not compile

(ptrIMSUsersPtr)collectuser = ptrIMSBch->GetIMSUsers(FALSE); - does
not compile

Can someone help? I am a little confussed.

Ultimately we are going to have a function that returns a couple non
related data types as well as a collection. However the collection
will never be used in my interface but the dll I am interfacing with
requires the collection as something that needs to be returned because
other future interfaces might require the use of the collection. This
seems strange for me to ask to define something that is not used
directly but nonetheless it happens to be the case so given that I
need to do make sure that the collection is defined properly so that
it compiles and that can hold the returned data.

Any ideas?

Thanks
Jake

推荐答案

2007年2月7日星期三14:59:46 -0800,Jake写道:
On Wed, 07 Feb 2007 14:59:46 -0800, Jake wrote:

你好


我正在使用VB程序连接C ++程序
Hello

I am interfacing a C++ program with a VB program



[...]


我想你可能宁愿尝试在VB论坛上询问,因为它似乎是

您需要的信息是高度VB特定的;这个新闻组仅用C ++ *语言*问题处理




祝你好运,


-

Lionel B

[...]

I think you might rather try asking in a VB forum, as it appears that the
information you require is highly VB-specific; this newsgroup deals only
with C++ *language* issues.

Good luck,

--
Lionel B


*杰克:
* Jake:

>

我正在使用VB程序连接C ++程序,我试图确定如何在我的c ++程序中正确定义集合。
>
I am interfacing a C++ program with a VB program and I am trying to
determine how to properly define the collection in my c++ program.



[snip]

[snip]


struct _IMSUsers *< ---这是否意味着C ++看到了收藏

作为结构的ptr?
struct _IMSUsers * <---Does this mean that C++ sees the collection
as a ptr to a structure?



当您在使用基本C语法时,您不应该尝试使用其他语言来连接C ++。



毫无疑问,你会得到它工作它会充满虫子。


算了吧。


-

A:因为它混乱了人们通常阅读文字的顺序。

问:为什么这么糟糕?

A:热门帖子。

问:usenet和电子邮件中最烦人的事情是什么?

When you''re struggling with basic C syntax you should not be attempting
to interface C++ with other languages.

No doubt you''ll get it to "work" and it will be full of bugs.

Forget it.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


2月7日下午6:46,Alf P. Steinbach < a ... @ start.nowrote:
On Feb 7, 6:46 pm, "Alf P. Steinbach" <a...@start.nowrote:

* Jake:
* Jake:

我正在连接使用VB程序的C ++程序,我试图确定如何在我的c ++程序中正确定义集合。
I am interfacing a C++ program with a VB program and I am trying to
determine how to properly define the collection in my c++ program.



[snip]


[snip]


struct _IMSUsers *< ---这是否意味着C ++看到了收藏

作为结构的ptr?
struct _IMSUsers * <---Does this mean that C++ sees the collection
as a ptr to a structure?



当你在使用基本的C语法时,你不应该尝试使用其他语言来连接C ++。



毫无疑问,你会得到它工作它会充满虫子。


算了吧。


-

A:因为它混乱了人们通常阅读文字的顺序。

问:为什么这么糟糕?

A:热门帖子。

问:usenet和电子邮件中最烦人的事情是什么?


When you''re struggling with basic C syntax you should not be attempting
to interface C++ with other languages.

No doubt you''ll get it to "work" and it will be full of bugs.

Forget it.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?



如果你对这个问题没有任何真正的洞察力,我不知道为什么你浪费了你的时间。也许你只是想让自己感觉更优越无论是什么原因(小阴茎),但我真正想要的只是一些

帮助。毕竟这就是这些团体存在的原因。你尝试寻求帮助时侮辱我的尝试只会让你失望

就像一个混蛋。

I''m not sure why you wasted your time posting if you didn''t have any
real insight into the issue. Maybe your just trying to feel superior
for whatever reason (tiny penis) but really all I wanted was some
help. After all that is the reason these groups exist. Your attempt
to insult me while I am trying to ask for help only makes you come off
like a jerk.


这篇关于C ++和集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆