473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

IEnumVariant in C#

Hello,

I need to derive an interface in C# from a COM interface that has been
declared in C++, and this parent interface uses the type IEnumVariant a a
function parameter. Since the stdole namespace does not know about this
type, the C# code fails to compile. I have no idea what to do, I cannot
change the original interface. Does anyone have a suggestion for this
problem?

Thank you for your help.

Regards,
Jozsi
Nov 17 '05 #1
2 3875
Hello,

The interface in question is defined in %WINSYSDIR%\stdole32.tlb as follows:

[
odl,
uuid(00020404-0000-0000-C000-000000000046),
hidden
]
interface IEnumVARIANT : IUnknown {
HRESULT _stdcall Next(
[in] unsigned long celt,
[in] VARIANT* rgvar,
[out] unsigned long* pceltFetched);
HRESULT _stdcall Skip([in] unsigned long celt);
HRESULT _stdcall Reset();
HRESULT _stdcall Clone([out] IEnumVARIANT** ppenum);
};

As it is hidden, tlbimp.exe does not transfer its declaration to the interop
library. However, in the .NET world, this interface's counterpart is
System.Collections.IEnumerator (according to MSDN article titled
'Troubleshooting .NET Interoperability'), and I guess this is what you need
to use.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Jozsef Bekes" <bj****@hotmail.com> wrote in message
news:ec****************@TK2MSFTNGP14.phx.gbl...
Hello,

I need to derive an interface in C# from a COM interface that has been
declared in C++, and this parent interface uses the type IEnumVariant a a
function parameter. Since the stdole namespace does not know about this
type, the C# code fails to compile. I have no idea what to do, I cannot
change the original interface. Does anyone have a suggestion for this
problem?

Thank you for your help.

Regards,
Jozsi


Nov 17 '05 #2
Hi

It did compile, thank you for your help.

Jozsi

"Dmytro Lapshyn [MVP]" <x-****@no-spam-please.hotpop.com> wrote in message
news:u6****************@TK2MSFTNGP12.phx.gbl...
Hello,

The interface in question is defined in %WINSYSDIR%\stdole32.tlb as
follows:

[
odl,
uuid(00020404-0000-0000-C000-000000000046),
hidden
]
interface IEnumVARIANT : IUnknown {
HRESULT _stdcall Next(
[in] unsigned long celt,
[in] VARIANT* rgvar,
[out] unsigned long* pceltFetched);
HRESULT _stdcall Skip([in] unsigned long celt);
HRESULT _stdcall Reset();
HRESULT _stdcall Clone([out] IEnumVARIANT** ppenum);
};

As it is hidden, tlbimp.exe does not transfer its declaration to the
interop library. However, in the .NET world, this interface's counterpart
is System.Collections.IEnumerator (according to MSDN article titled
'Troubleshooting .NET Interoperability'), and I guess this is what you
need to use.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Jozsef Bekes" <bj****@hotmail.com> wrote in message
news:ec****************@TK2MSFTNGP14.phx.gbl...
Hello,

I need to derive an interface in C# from a COM interface that has been
declared in C++, and this parent interface uses the type IEnumVariant a a
function parameter. Since the stdole namespace does not know about this
type, the C# code fails to compile. I have no idea what to do, I cannot
change the original interface. Does anyone have a suggestion for this
problem?

Thank you for your help.

Regards,
Jozsi

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jon Grieve | last post by:
Hi, I'm very new to PHP, and am toying with some COM samples... specifically the Windows FileSystem object. This object has a property Drives, which returns a collection of Drive objects (one...
1
by: Brian Kelly | last post by:
Recently (and all of a sudden), I've been receiving the following error message in an ASP.NET application that loops through a COM collection via interop: "QI for IEnumVARIANT failed on the...
1
by: Josh | last post by:
Hi, I am using an OCX from VB6 that has a routine that outputs a collection. If "Params" is defined as a collection in VB6, The following statements (in the VB6 debug window) works:...
4
by: Benjamin Piorczig | last post by:
Hello list memebers, I'd like to use a C# Collection with from within Visual Basic 6. I have derived a my ComInterface class from IList and implemented those Members. Everything seems to work...
0
by: JackWarner | last post by:
OK, I'm finally getting our organization to upgrade from v6, and the first project I try to recompile I run into hairy problems. We've used this ATL COM collection class for years. It looks like...
2
by: Simon Jefferies | last post by:
Hello, I've created a fresh VB.NET Setup project using the wizard. When I build the project I get the following error message: ERROR: An error occurred while validating. HRESULT = '80004002'...
1
by: tulasi | last post by:
Try Dim wia As New WiaClass Dim div As DeviceInfoClass wia.Create(div) 'wia.Devices()
2
by: Jayme Pechan | last post by:
Is there a simple way to return a COM enumeration interface from .NET? I am porting a C++ COM Object that has an enumeration interface containing the DISPID_NEWENUM and DISPID_VALUE properties and...
9
by: Larry Bates | last post by:
Does anyone know if there is a way to make a Python COM object act like a proper iterator in VB/Delphi? Example: Python COM object class foo: _public_methods_=
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.