com-interop

What's the purpose of COM+ library applications?

落花浮王杯 提交于 2019-12-23 09:41:13
问题 When a COM+ application is created the wizard offers to choose between a library and a server application. A server application is activated in a separate process and this can be used to cheaply interop 64-bit consumers with 32-bit in-proc COM components. What's the use of library applications that are activated right in the caller process? Why use them instead of plain old in-proc COM servers? 回答1: There are several: Performance - it is a bit faster as you don't have to go through the

How Does a COM Program Locate a .NET DLL Registered for COM Interop?

我的未来我决定 提交于 2019-12-23 07:57:21
问题 One customer wants to consume our .NET DLLs from VB6. They are designed to support reverse interop and all works fine... except: There are two separate VB6 programs in two different directories. It seems it's necessary to do one of: Copy the .NET DLL into both directories, or Install the .NET DLL in the GAC This is the customer's observation and also supported by the RegAsm documentation: After registering an assembly using Regasm.exe, you can install it in the global assembly cache so that

Create GUI in C# and call in VBScript

為{幸葍}努か 提交于 2019-12-23 04:42:18
问题 I try to make an ActiveX by C# with COM-visible. It is a Windows Form. I built it successfully as a dll ActiveX, then I wrote a VBScript code to call it. The from appeared but disappeared right after that. I don't know why @@ Here is my code: C# code using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; using Microsoft.Win32; using System

tlbimp.exe converts HWND to _RemotableHandle

巧了我就是萌 提交于 2019-12-23 03:17:09
问题 Our COM component interface has the next method: HRESULT CreatePluginWindow([in] HWND hParent, [in] RECT* prcView); We are going to use it in .NET application but interop for this interface is looking like this: void CreatePluginWindow(ref interop.alfrontx._RemotableHandle hParent, ref interop.alfrontx.tagRECT prcView) According my investigation there is no way to use this method without unsafe code. I'd not like to change COM interface in order to use other than HWND type for hParent,

COM Interop with VB6 and C#

寵の児 提交于 2019-12-23 02:43:31
问题 I'm writing a C# COM object that will be used by a VB 6 program. That shouldn't be much of a problem, however, the VB6 call to the COM object passes in a VB Control (in this case a TextBox). The program expects the COM object to alter the Text property of the control. Unfortunately, I have to stick to this interface as I'm dealing with someone elses legacy code. How can I set the property for the passed in TextBox? Do I simply create an interface with a Text property and cast input to that

How do I register a proxy/stub for a COM interface defined by a third party?

喜欢而已 提交于 2019-12-23 01:12:40
问题 There's Another Company that ships the product that consumes IAnotherCompanyInterface. We want to ship a COM object that implements IAnotherCompanyInterface. That interface is not Automation-compatible, so the next easiest option to enable marshalling is using a proxy/stub. Another Company doesn't ship the proxy/stub and doesn't want to. Compiling and registering the proxy/stub is not a problem by itself but consider the following situation. There's our company shipping a COM object

COM interop passing wrong pointers, with only a single byte of my data

寵の児 提交于 2019-12-22 12:45:29
问题 I'm having a problem passing pointers to native code using COM. I want to build up a byte array in managed (C#) code and pass that array to native (C++) code. I'm handling the managed-code side, and my colleague owns the native side. Note that I'm much stronger on the managed side, and I've pretty much been using the COM object as written. The COM signature (simplified) looks this: unsafe void DoSomething([In] byte* buffer, [In] uint length) And I call it like this: var arr = File

Problem creating COM-library only containing enum's

馋奶兔 提交于 2019-12-22 10:46:00
问题 I'm am doing a COM-interop project. Substituting some VB and C++ ATL COM projects with C# and .NET Interop. When i define enumerations in .NET and they are made ComVisible, they get exposed as Typelib.EnumType_EnumValue enstead of just Typelib.EnumValue. The typelib exporter does this to ensure that the value names are unique. But i know that all my enum's are unique, so i don't want the underscores. Also there is a lot of client code that needs alteration if i don't get rid of the

How can I manipulate a VB6 Collection in .NET?

送分小仙女□ 提交于 2019-12-22 10:38:32
问题 I am currently in the process of designing an interface for .NET software that would be consumed by COM objects - specifically, VB6. While I have found a number of pages by Microsoft detailing how to make an COM-interoperable interface, I am currently tripping over the use of Collections in design time: I would like to be able to use a standard VB6 "Collection object" in the .NET program - that way, I would be able to specify, in the interface, such a collection as an argument, or as a return

Trying to build a COM Component in C# that can be referenced and used from VB5/6

坚强是说给别人听的谎言 提交于 2019-12-22 09:55:02
问题 I am trying to see if I can build a COM component in C# (.NET 4) which I can use from a VB5 program (cue derisive remarks) to access a web service. Following all the instructions I have been able to find on MSDN and CodeProject as follows: Building COM Objects in C# Example COM Class (C# Programming Guide) I have written the following: [Guid("7A715F02-D349-45DC-B0AE-9925FD3B943C")] public interface ARCOM_Interface { [DispId(1)] string GetServiceResponse(); } [Guid("5130F041-619E-41F9-84B6