Questions tagged [com]

Component Object Model (COM) is a component technology from Microsoft, featuring remoting, language independence and interface-based programming. For questions about the COM serial port, you should use the [serial-port] tag instead.

Component Object Model (COM) specifies an architecture, a binary standard, and a supporting infrastructure for building, using, and evolving component-based applications.

Some of the core features of COM are:

  • A remoting infrastructure
  • The use of interface-based programming
  • A threading model
  • The ability to write language independent components.

COM is the foundation of technologies such as OLE, ActiveX and COM+.

COM predates .NET and although .NET has replaced some of the features that developers use COM for it is still a crucial technology and the foundation of most inter application communication on Windows.

External links

12235 questions
4
votes
1 answer

Returning a string from an unmanaged c++ dll to c#

I'm trying to call unmanaged c++ from c# but receiving an exception about the return value. The exception: System.Runtime.InteropServices.MarshalDirectiveException: 'Cannot marshal 'return value': Invalid managed/unmanaged type combination (Arrays…
as2005
  • 63
  • 1
  • 3
4
votes
1 answer

How to pass an uninitialized array from VB6 to .NET via COM?

I want to replace a component written in VB6 with a new component written in VB.NET. The new component has to work with other VB6 applications until these are replaced as well. I'm having trouble with a function that takes string arrays as…
BenZinra
  • 270
  • 2
  • 10
4
votes
3 answers

How to deliberately crash a COM object

Maybe a strange question, but I need to test the stability and error procedures of the host process (caller) that accesses COM objects. Therefore I need some easy/short methods to let the COM object(s) crash itself. Addition 1: With crash I mean the…
user564548
4
votes
1 answer

Use COINIT_APARTMENTTHREADED or COINIT_MULTITHREADED in Media Foundation?

In my research of Media Foundation I've encountered some seemingly contradictory advice from two very reputable sources. From MSDN: Media Foundation and COM: https://msdn.microsoft.com/en-us/library/windows/desktop/ee892371(v=vs.85).aspx In Media…
4
votes
2 answers

Standard COM marshaler fails with REGDB_E_IIDNOTREG

I'm trying to marshal an interface to another thread. Windows provides the convenient CoMarshalInterThreadInterfaceInStream helper function to take care of the boilerplate code associated with using CoMarshalInterface directly. const Guid…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
4
votes
2 answers

64 bit COM(ActiveX) server

I have activex server exe that was building and registering fine on 32bit OS. I wanted to make 64 bit version of that exe by upgrading project to Visual Studio 2010 and changing platform to X64 which apparently doesn't work. Application itself works…
Velja Radenkovic
  • 716
  • 1
  • 6
  • 27
4
votes
2 answers

Extracting thumbnail and icon from file in c#

I'm trying to extract thumbnail or icon if the thumbnail is not available from a file or folder like windows explorer. I'm using IShellItemImageFactory and when the thumbnail is present it works nicely. However, if the file does not have a thumbnail…
Giorgi
  • 30,270
  • 13
  • 89
  • 125
4
votes
2 answers

Reading comments from Excel file with PowerShell

My searches only led to something similar in VBA, but I have a different approach and in PowerShell for this problem. I am new to PowerShell and I want to read all comments in Excel files and save them to a CSV file. Everything works except for…
Rhamnetin
  • 41
  • 4
4
votes
1 answer

Consume JAR from .Net Core

How do I consume a JAR (obviously developed in Java) inside of .Net Core? In .Net world, we could register it as a COM Component and access the same. I know that .Net Core doesn't yet support COM components. Libraries like IKVM / JNBridge do not yet…
4
votes
3 answers

What is the correct syntax when passing CComSafeArray to a method expecting SAFEARRAY**

This most likely has a very simple answer, but I can't figure it out. I'm trying to refactor some code that looks like this: SAFEARRAY* psa; long* count; HRESULT hr = pSomeInterface->ListSomething(&psa, &count); if (SUCCEEDED(hr)) { …
aNDo
  • 41
  • 1
  • 3
4
votes
1 answer

How can script source position determined from inside an automation call?

I have a script host which runs JScript. There are some cases when I have to trace if a method of my exposed objects is called and from where it got called. For that I need to determine where is the script engine currently inside my object's method.…
r4w8173
  • 598
  • 6
  • 15
4
votes
2 answers

How To Enumerate All coclasses That Implement A Particular COM Interface?

I will describe the problem as simple as i can; Let's say we have a com client that defines several interfaces. In order to improve our com client's functionality; several, independent companies develops & deploys com servers that implements the…
user540983
4
votes
1 answer

Versioning windows COM objects

I am developing two applications which both have .NET4 assembly of the same name, different version. This assembly exposes some COM objects. Is it possible to install both applications, and maintain COM objects of both assemblies? I have some decent…
Dlongnecker
  • 3,008
  • 3
  • 25
  • 40
4
votes
3 answers

Run Microsoft Excel application from MemoryStream

Does someone knows, is it possible to open Microsoft Excel from unsaved file? From memory stream for example? var workbook = new XLWorkbook(); var worksheet = workbook.Worksheets.Add("Sample Sheet"); worksheet.Cell("A1").Value = "Hello…
4
votes
3 answers

C# COM implement enumerable without referencing MSCORLIB

I am creating a COM interface which should allow to use For Each in Visual Basic Scripts and IEnumVariant in C++. The gotcha is that I don't want that the C++ client application needs to import mscorlib.tlb. So far my interface…
peval27
  • 1,239
  • 2
  • 14
  • 40