interop

How to obtain the native stacktrace from native exceptions caught in managed code

I have some managed code that calls to a method inside some native DLL(i have the appropriate symbol files). Sometimes, that native method throws an exception which I catch in my managed code. However, when i print the stacktrace from my caught exception, I see only managed code (the last frame is the call to the native code .. but it do...

VB6 App + .Net component working as compiled app but not in VB6 IDE

I have a VB6 App that uses a .Net component (via a .tlb reference in the VB6 app) which is working fine when executed as a compiled app, but it produces an error from the VB6 IDE a certain point when it is trying to use the .NET component. I should note that the error occurs when the .NET component is meant to be invoking a third party ...

Usage of the "SAP Function OCX"

Does it make sense to use the "SAP Function Control" (wdtlog.ocx in connection with wdtlog.ocx and wdtaocx.ocx) to access (via the Interop-Assemblys SAPFunctionsOCX.dll, SAPLogonCtrl.dll and SAPTableFactoryCtrl.dll) to SAP with RFCs instead of the no longer supported SAP Connector of .NET ? I know there is also the product ERPConnect o...

How can we expose a .NET public const to COM interop

For historical reasons, we need to expose string constants in .NET through COM interface. We managed to expose ENUM but we can't find a way to expose string const. We try the following code : <ComClass(ComClass1.ClassId, ComClass1.InterfaceId, ComClass1.EventsId)> _ Public Class ComClass1 #Region "COM GUIDs" ' These GUIDs provid...

Question about registering COM server and Add Reference to it in a C# project

I build a COM server in raw C++. And I have some trouble when adding reference to it. Here is the procedure: (1) write an IDL file to define the interface and library. (2) use msidl.exe to compile the IDL file to necessary .h, .c, .tlb files. (3) implement the COM server in C++ and build a .dll file. (4) add the following registry entr...

"Could not load file or assembly" error on trying to access auxillary assemblies from COM

We have the project structure as follows: COMExposedCCW.dll -refers-> BusinessLayer.dll -refers-> Utils.dll COMExposedCCW.dll -refers-> Utils.dll The COMExposedCCW.dll has been registered for COM interop. From the COM application we can successfully create the CCW object and access its properties, but when we try to invoke methods th...

C# to unmanaged dll data structures interop

I have a unmanaged DLL that exposes a function that takes a pointer to a data structure. I have C# code that creates the data structure and calls the dll function without any problem. At the point of the function call to the dll the pointer is correct. My problem is that the DLL keeps the pointer to the structure and uses the data s...

Passing a SAFEARRAY from C# to COM

I use 3rd party COM to find faces in a picture. One of the methods has the following signature, from SDK: long FindMultipleFaces( IUnknown* pIDibImage, VARIANTARG* FacePositionArray ); Parameters: pIDibImage[in] - The image to search. FacePositionArray[out]- The array of FacePosition2 objects into which face informa...

Need to call COM component using reflection in .NET

I need to determine the COM component(unmanaged code) type and invoke the exposed interface's methods using reflection in C# at runtime. First What member of "Type" tells that type is COM component and we can take CLSID at runtime? Is Type.COMObject? I need to call methods of exposed interfaces as they called in unmanaged code using C...

How do I use an unregistered dll from c#?

I have a custom dll (not registered) that I need to access via c#. How do I do this without registering the DLL? Edit: It is a C++ dll. ...

Experiences with IKVM.NET

Is IKVM.NET a good way to use Java Code or Java Libs in .NET applications? Has anybody experiences with this tool? Are there alternatives? Are there possibilities to call Java functions/code in COM-based applications like Visual Basic 6 or Classical ASP? ...

Is .NET support for Win32 Code Interop?

Hello, I need to InterOp Win32 code (unmanaged Win32 DLL's and Exe) completely with .NET. I need to call Win32 unmanaged code(DLL exported functions) at runtime i.e (knowing the types of data types in Win32 signatures and need to pass data according to that type at runtime). This is 100% possible in case of COM. You can convert COM unm...

C# and C++ Library

I was wondering if I can use a library -written in C++- in C# The problem is that library has its own structures and classes.. Will I be able to use it in C#? Thanks EDIT This library is open source.. so if my requirements needs something special in C++ code, I will be able do it... ...

MS Access Interop - How to set print filename?

Hi all, I'm using Delphi 2009 and the MS Access Interop COM API. I'm trying to figure out two things, but one is more important than the other right now. I need to know how to set the file name when sending the print job to the spooler. Right now it's defaulting to the Access DB's name, which can be something different than the file's ...

What standards and best practices should I follow to write interoperable portlets or web gadgets?

I am trying to design the standards and patterns for implementing portlets/web gadgets with the main goal of maximizing interoperability if those components were hosted in a Java app server framework or within an existing ASP.NET technology (SharePoint webparts), or a client side-only framework. Is there any guidance anywhere of the par...

Word Interop compile time error

I am getting the following error when referencing the assembly Microsoft.Office.Interop.Word in my asp.net application. The type 'Microsoft.Office.Interop.Word.ApplicationClass' exists in both 'C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Word\11.0.0.0_71e9bce111e9429c\Microsoft.Office.Interop.Word.dll' and 'C:\WINDOWS\assembly\GAC...

Any drawbacks in using LoadLibraryEx() instead of CoCreateInstance() for reg-free COM component consumption?

Our program needs to consume the COM server which is also made by us. The scenario is the following: the installer will copy both the program files and the COM server files into the same folder on each install. Currently we use regsvr32 to register the COM server, but this is not very good - if we develop another unrelated program that ...

.NET interop COM DLL behaves differently in VB6 debugger

I have a .NET v2.0 Dll that exposes a few classes to COM. The assembly is called BLogic.DLL I'm calling these classes from a legacy visual basic 6.0 application. I can generate and EXE file and if I have Blogic.dll in the same folder as the EXE, the program runs without a hitch. However If I try and launch the same program within the V...

COM Interop & Outlook - Make Outlook Visible?

I'm automating Outlook from a VB.NET program, transferring items into the calendar and contacts at the user's request. It's all working, that isn't the problem; the problem is that automating Outlook like this when it wasn't already open creates a hidden instance. I can perhaps understand how this could be useful, to stop the user closin...

C# app that uses Excel Interop, easy switch between 2003 2007?

I have an app written that just does really basic I/O on a spreadsheet. Read in a bunch of cells, do some sorting, and dump the output back into another spreadsheet. Works great on my machine. I have Office 2003 installed. When it runs on someone elses machine with 2007, it bombs, presumably due to the different versions of the Interop ...