Hi,
Introduction
***************
I have a system build of a collection of 'Native COM objects' and '.NET COM interop' objects, all of the COM objects are managed through a 'Native COM' layer, this layer manage the underlying COM Objects and upon request, provide a pointer to those objects to the 'API Consumer', following is an illustration of the system:
API Consumer ( Native C++/C# )
||
*******************************************
* Native COM Management layer *
*******************************************
||
==============
|| ||
Native COM .NET COM Interop
Object Object ( C# )
The problem:
*****************
When the 'API Consumer' uses Native C++ COM, there is no problem getting the underlying COM interface of the '.NET COM interop' object from the Management layer, BUT when the 'API Consumer' is written in C# the interface query fails with the following error: "QueryInterface for interface ISomeInterface failed.", following is the flow of the two scenarios:
1. Native C++ 'API Consumer':
***********************************
1.1. Use Native C++ to access the Management later COM ( Native )
1.2. Use the 'Native Management COM layer' to get the
interface of the '.NET COM interop' object.
1.3. The Native C++ Consumer SUCCESSFULLY uses
the interface provided by the 'Native Management COM layer'.
2. Managed C# 'API Consumer'
************************************
1.1. Use Managed C# to access the Management later COM ( Native )
1.2. Use the 'Native Management COM layer' to get the
interface of the '.NET COM interop' object results "QueryInterface
for interface ISomeInterface failed."
Following is the code flow:
1. Start the Managed C# client.
2. Create Native C++ COM management layer.
3. Create Managed C# COM interop object ( by the management layer ).
4. Ask the management layer for a certain interface of the Managed C# COM object <= Returns "QueryInterface
for interface ISomeInterface failed."
Why can't I get the interface of the managed C# COM? why does a Native C++ consumer has no problem getting the interface and a managed C# consumer does?
ThanX
Nadav. 1 1982
I'm not too sure what you're trying to do, but from what i can tell is
this...
you want a c# client to call a COM object, which is a c# .net object,
installed as a COM object via the interop?
This cannot be done, since both the client and server objects are running on
the CLR, they want to bind in .Net fashion, not switching to native code,
then back again.
..Net client can call a .Net object
..Net client can call a native (c++) COM object
native app can call a .Net object, provided it exposes the vtable, or
iDispatch pointer via interop
..Net client cannot call the .Net object via the vtable, or iDispatch pointer
(through interop) because it recognises the object as .Net, and so must be
called via .Net "referencing".
hope that helps.
Dan
"Nadav" <No*@today.com> wrote in message
news:Oz**************@TK2MSFTNGP11.phx.gbl...
Hi,
Introduction
***************
I have a system build of a collection of 'Native COM objects' and '.NET COM
interop' objects, all of the COM objects are managed through a 'Native COM'
layer, this layer manage the underlying COM Objects and upon request,
provide a pointer to those objects to the 'API Consumer', following is an
illustration of the system:
API Consumer ( Native C++/C# )
||
*******************************************
* Native COM Management layer *
*******************************************
||
==============
|| ||
Native COM .NET COM Interop
Object Object ( C# )
The problem:
*****************
When the 'API Consumer' uses Native C++ COM, there is no problem getting the
underlying COM interface of the '.NET COM interop' object from the
Management layer, BUT when the 'API Consumer' is written in C# the interface
query fails with the following error: "QueryInterface for interface
ISomeInterface failed.", following is the flow of the two scenarios:
1. Native C++ 'API Consumer':
***********************************
1.1. Use Native C++ to access the Management later COM ( Native )
1.2. Use the 'Native Management COM layer' to get the
interface of the '.NET COM interop' object.
1.3. The Native C++ Consumer SUCCESSFULLY uses
the interface provided by the 'Native Management COM layer'.
2. Managed C# 'API Consumer'
************************************
1.1. Use Managed C# to access the Management later COM ( Native )
1.2. Use the 'Native Management COM layer' to get the
interface of the '.NET COM interop' object results "QueryInterface
for interface ISomeInterface failed."
Following is the code flow:
1. Start the Managed C# client.
2. Create Native C++ COM management layer.
3. Create Managed C# COM interop object ( by the management layer ).
4. Ask the management layer for a certain interface of the Managed C# COM
object <= Returns "QueryInterface
for interface ISomeInterface failed."
Why can't I get the interface of the managed C# COM? why does a Native C++
consumer has no problem getting the interface and a managed C# consumer
does?
ThanX
Nadav. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: js |
last post by:
Hi all,
I currently encounter a problem and it is urgent to me.
After calling the MsgBox.Show(), the message box is shown with non-modal
mode, what is the possible reason??? This only happen...
|
by: Kevin Flanagan |
last post by:
This can be reproduced with VS.NET as follows. Create a new ATL
project with default wizard settings (dll, attributed). To the
'module' attribute, add a specifier 'version = "1.10" ' alongside the...
|
by: Chris B. |
last post by:
If anyone can figure out how to implement the following C++ function in C#
using interop, I'd be very appreciative.
I have not been successful in getting it to work correctly using interop...
|
by: em |
last post by:
Hi all,
I'm getting some problems importing a DLL that I made in C# within VB6.0.
The C# is quite easy, just for trying:
namespace TestDll
{
public class Class1
|
by: Alex D. |
last post by:
Hi .I cant seem to find a way to authorize asp.net user to create an Excel
application using this: Microsoft.Office.Interop.Excel.ApplicationClass
excel = new...
| |
by: Steve |
last post by:
I'm using Visual Studio .NET (not 2003), and am
developing a class that works with Word theough the
Office PIAs (Interop). I can open word and do things
with it programatically, but I can't close...
|
by: scorpion53061 |
last post by:
in my head......
I need my application to work with Office 97, 2000, XP and 2003 versions of
MS Word and MS Excel.
IN order to acomplish this I have to install in different folders:
1....
|
by: John |
last post by:
Hi all,
I did post this about 10 hours ago thinking I would have received an answer
now but it is quite urgent.
How do I add a COM object to a web form?
I notice there's a primary interop...
|
by: Niyazi |
last post by:
Hi
I have a report that I have to run it monthly in my machine.
My code in VB.NET and I access AS400 to get data, anaysie it and send into
pre formated Excel sheet. The data consist of 9000...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |