com-interop

Calling a VB6 DLL function with a complex User Defined Type (UDT) from C#

独自空忆成欢 提交于 2019-11-28 03:33:51
问题 I am writing a C# application to call a third party VB6 DLL. I have added reference to the VB6 DLL in the References->COM tab. A particular method in the DLL takes a VB6 UDT (User Defined Type) as a parameter. This UDT is shown as a struct in the auto generated .NET wrapper for COM. The struct has lots of child UDTs / structs as well as members of type VBA.Collection (as shown by .NET metadata). It also has regular data types like string, short, double, int, etc. I am initializing this struct

What causes error HRESULT: 0x80010105 (RPC_E_SERVERFAULT)?

混江龙づ霸主 提交于 2019-11-28 02:58:41
问题 I created a ASP.NET web service that uses a 3rd party payment processing engine to authorize credit card transactions. The web service is hosted on a separate application server and connects to the payment processing server via an ActiveX object ( .ocx extension). Lately, it has been generating a HRESULT: 0x80010105 (RPC_E_SERVERFAULT) exception when I try to establish an connection to the application using an " IsAvaiable " check. Does anyone recommend an good place to start for researching

.NET database calls slow when using COM Interop, fast via query analyser

寵の児 提交于 2019-11-28 02:10:34
问题 I have an Sql query that looks up a person based on SSN and returns the PersonID (identity column). There is a index on the SSN column in the persons table. I have an old VB 6 application that uses COM/.NET interop to call this query. When it does it runs relatively slow. I set up a trace using SQL Profiler and each call has a duration between 400ms-600ms. If I run the very same query via the query analyser, I get a duration < 30ms. I also have a ASP.NET web site that makes the same exact

How to tell if Excel Application is in cell-edit mode?

旧时模样 提交于 2019-11-28 02:04:28
问题 I'm writing an Excel Addin using COM Interop from .net. I have a command that pops up a dialog, and from the dialog I do some work like collecting data from the used range of several sheets. The problem is that if a cell is in edit mode, some of the calls that I need to make will throw exceptions. I would like a way of determining before-hand that Excel is in edit mode, so that I can warn the user to finish editing the cell first. Any ideas? 回答1: There is an Application.Ready property that is

Using C# COM in unmanaged C++ project -> First-chance exception at 0x7697C41F (KernelBase.dll)

牧云@^-^@ 提交于 2019-11-28 01:21:31
I'm trying to call methods from a C# COM project in an unmanaged Visual C++ solution, but I keep getting the next error First-chance exception at 0x7697C41F (KernelBase.dll) in Program.exe: 0x04242420 (parameters: 0x31415927, 0x6F310000, 0x00BBDAE8). at the next piece of code SalesForceNew::IMyObjectClassPtr p; p.CreateInstance(__uuidof(SalesForceNew::TestObject)); // error SalesForceNew::MyObject mo = p->getObject(1, "a"); However the value of mo is as expected (5, "aa"). I import the tlb-file with this line of code: #import "C:\Users\Bob\Desktop\ComTest\SalesForceNew\bin\x86\Debug

Why doesn't the office PIA install correctly to the GAC?

ε祈祈猫儿з 提交于 2019-11-27 23:18:18
问题 I am currently working on a c# project, where I need to access Outlook. The development is being done on two different machines, one of which has office installed, and one of which doesn't. I previously asked how to compile my project against the outlook com object, and one of the comments suggested that I compiled against the office primary interop assembly, or PIA. In my downloaded Office 2007 PIA, there is an msi file, that is supposed to install a number of PIAs for the different parts of

Compiling Quantlib via SWIG for C#

亡梦爱人 提交于 2019-11-27 22:33:21
Anyone have any experience using SWIG ? I am currently researching QuantLib and saw that C# code can be generated using SWIG. We are exploring options to create a combined library of financial functions using QuantLib and a proprietary closed source library (which will probably be made available as .Net dlls). The idea is to combine both of these to create a unified super library. I have seen the .Net port of QuantLib , but it seems that it is not actively maintained (and not entirely sure of how much was actually ported), so I am avoiding it. Step 1 of this is to evaluate the difficulty in

Why would I use “Both” COM threading model instead of “Free”?

感情迁移 提交于 2019-11-27 21:45:44
问题 According to this article if I register my COM object with either "Both" or "Free" threading model that object must be completely thread-safe. Specifically all accesses to global shared variables must be synchronized and all accesses to member variables must also be synchronized. That's a lot of effort. Now I understand that being able to register my object as using "Free" threading model is advantageous and might be worth paying the price of making it completely thread-safe. But why would I

Is the 'Implemented Categories' key needed when registering a Managed COM Component?

浪子不回头ぞ 提交于 2019-11-27 21:44:58
问题 When registering a managed class for COM Interop by hand, certain registry keys are needed. For example HKEY_CLASSES_ROOT CLSID\[My Cls Id] InprocServer32 (Default) = "mscoree.dll" Assembly = [My assembly name] etc. I've noticed that when VS registers a library for COM Interop, it also adds a key HKEY_CLASSES_ROOT CLSID\[My Cls Id] Implemented Categories {62C8FE65-4EBB-45e7-B440-6E39B2CDBF29} What is this key for, and is it absolutely necessary? As far as I can tell, life goes on just fine

Converting between 2 different libraries using the same COM interface in C#

不羁的心 提交于 2019-11-27 21:26:14
问题 I have a pair of libraries that both use the same COM interface. In one library I have a class that implements that interface. The other library requires an object that implements the interface. However both libraries have their own definition of the interface. Both are slightly different but essentially the same interface. So I try to case between them as follows: Library2.Interface intf = (Library2.Interface)impl; but this raises as an exception. If I do the following: Library1.Interface