com-interop

How can I access window.document object from ActiveXObject?

How can I access window.document object from ActiveXObject in InternetExplorer? I'm using C# language for my ActiveXObject. Thanks Paul. ...

Exposing functionality via Prism & Com Interop

How does one go about exposing a class written in Prism via COM Interop? For example, given the following interface: TYPE IFoo = public interface property bar: string; read; end; FooImpl = class( IFoo ) private function GetBar : string; public property bar: string; read GetBar; end; In this example, assume I...

Returning an array from JS to C# with COM-Interop

I'm returning some data from my JavaScript code to my C# code via COM Interop and the WebBrowser WPF control. I have successfully returned the data which looks like this in Javascript: var result = new Array(); result[0] = cbCamera.selectedItem; result[1] = cbMicrophone.selectedItem; Now I have the object result in C# which looks li...

Implementing ISupportErrorInfo on a C# object exposed to COM

I'm writing a COM object in C# and I'd like to raise errors to vba/asp client software using the mechanism it understands - the Err object. In good ol' days that would have meant implementing ISupportErrorInfo on the COM object but I can't find any information about how to implement that interface in a C# object. Can anybody help? tha...

How Add a COM-Exposed .NET Project to the VB6 (or VBA) References Dialog?

I have created a .NET assembly that is exposed to COM according to the exceptional article Build and Deploy a .NET COM Assembly by Phil Wilson. And everything works fine in the sense that the .NET assembly is properly registered for COM, and compiled COM code can call it without any trouble. The only odd thing is that developing agains...

Mocking non-virtual Events (In COM interop classes)

Edit: Language/Platform is C# / .Net I'm currently trying to fill a vast unit-test void in my current project, and being admittedly new to TDD, find myself quite stumped as to how to go about testing some of the more business-critical features. I picked up Moq and had an easy enough time doing simple mocks, however at the core of my ap...

Hosting a Silverlight compatible Web Service in a Windows Service

Is it possible to create a Windows Service (background apps accessible in services.msc) application and host an ASP.NET WebService or a Silverlight compatible WebService within it? I want to create a WebService that performs COM interop calls to something and decided that a Windows Service that interfaces with COM directly as well as ho...

What's the purpose of noncreatable coclasses in IDL?

What is the reason for declaring noncreatable coclasses like the following in IDL? [ uuid(uuidhere), noncreatable ] coclass CoClass { [default] interface ICoClass; }; I mean such class will not be registered to COM anyway. What's the reason to mention it in the IDL file and in the type library produced by compiling that ID...

What's the difference between CoCreateInstance() and CoGetClassObject() when creating objects on the same machine?

I understand that CoCreateInstance finds the COM server for the given class id, creates the object instance for that id and retrieves an interface from that object instance. CoGetClassObject() finds the COM server for the class id, creates an instance of the class factory for that class id and retrieves that class factory interface which...

When and why use CoLoadLibrary?

The description of CoLoadLibrary() says it does pretty much the same as LoadLibraryEx() - loads a DLL into the process. COM classes creation functions - CoCreateInstance() and CoGetClassObject() - both do load the necessary DLL into the process too. Then why is CoLoadLibrary() needed in the first place and how should it be used? ...

Where is using null BSTR documented?

It's at least common practice to treat null BSTR (null WCHAR* pointer) as an empty string and design all the code manipulating BSTRs accordingly. Answers to this question say the same. Where is this practice documented? Is there any official document describing this convention? ...

warning MSB3391: <DLL> does not contain any types that can be unregistered for COM Interop.

I've made a simple C# DLL (that's part of a much larger project) using VS2005. I need to use the DLL in Excel via VBA code so I am using COM Interop on the assembly. I am trying to make the build process automatically generate the necessary TLB file so that I don't need to go to the command line and use regasm after every build. My pr...

Where is the Wrapper Assembly Key File setting in VS 2008?

I'm trying to build an application that is strongly named. It is referencing a COM interop library that I add via the Add References dialog. It's been a while, but I seem to recall that in older versions of visual studio, there was a project setting for Wrapper Assembly Key File. I can't seem to find it in Visual Studio 2008? ...

HOW DO I: Pass aggregated data between unmanaged and managed code using a COM interface in the .NET Compact Framework V2?

I have a COM interface in my unmanaged C++ project that my managed C# code can find and use successfully. Currently, all the interface methods use simple type arguments like UINT and DOUBLE. What I want to do is to aggregate data into a single structure that my C# code can create and pass through the COM interface to my unmanaged C++ c...

How to manage various ASP.NET Web Site project references and autoupdate

I have a Visual Studio 2008 Web Site project in a solution with a number of other assembly projects. The Web Site project has 4 types of references: Project, BIN, COM interop, and text files. The Project references autoupdate perfectly. The BIN references for managed DLLs autoupdate with .refresh files, which work well and can be chec...

How to use late binding to invoke method with ByRef parameters

I have a COM component that I want to call using late-binding from VB.NET (using the painful Primary Interop Assembly - PIA method) My IDL signature for the COM method looks like: HRESULT Send([in]BSTR bstrRequestData, [out]VARIANT *pvbstrResponseData, [out]VARIANT *pvnExtCompCode, [out,retval]int...

Excel hangs when printing the first time from ASP.NET webservice

We are using Excel to convert SpreatSheetML to XLS in an ASP.NET webservice. Moreover, if the user checks the right checkboxes, we spawn a thread that uses Excel to print the spreadsheet. Recently, we have deployed the app in a new environment, and then we started having problems: the first time someone tries to print, Excel seems to h...

COM Interop, isolation and excluding duplicate references

We are using a COM DLL provided by Microsoft (dsofile.dll) in a C# dll written by us (Assembly A). In order to avoid having to register the COM dll, I have switched the Isolated property on the reference to dsofile.dll to true. This means that when we compile our dll, visual studio copies dsofile.dll, Interop.DSOfile.dll and Native man...

HRESULT: 0x80010105 (RPC_E_SERVERFAULT) question

For my company, I created a ASP.NET web service that uses a 3rd party payment prcoessing engine to authorize credit card transactions. The web service is hosted on a seperate application server and connects to the payment processing server via an ActiveX object (.ocx extension). Lately, it has been generating a HRESULT: 0x80010105 (RPC...

Return byte array from C# to VBScript via COM interop

Hey all, I have C# method that returns a byte array I want to be able to access from VBScript. More or less: namespace ClassLibrary7 { [ClassInterface(ClassInterfaceType.AutoDual)] [Guid("63A77D29-DB8C-4733-91B6-3CC9C2D1340E")] [ComVisible(true)] public class Class1 { public void Create( out byte...