Questions tagged [com]

16 questions
9
votes
3 answers

Better to write your .NET library with COM limitations in mind, or separate your .NET library from Interop?

I came across this interesting article: How I Came to Love COM Interoperability on CodeProject, which got me thinking... The author argues that they do not want any COM-ities in their .NET library because it takes away from the beauty of their .NET…
robodude666
  • 275
  • 1
  • 8
7
votes
2 answers

C++ : What is the order of function pointers inside vtable?

In this answer to "In C++ why and how are virtual functions slower?", the author mentions below point: "Get the right function address from the vtable into a register (the index where the correct function address is stored is decided at…
6
votes
2 answers

Create Primary Interop Assemblies or generate them?

I've never seen this question answered definitively: If you are maintaining a COM DLL that can be used by a .NET program, is it best to: Import the COM DLL into each project, which generates an Interop assembly for each project? or Generate the…
5
votes
1 answer

Peculiar architecture interfacing .NET to AutoCAD out-of-process

I have written a set of classes to interact with AutoCAD from an out-of-process .NET assembly, but it seems like my class architecture and interactions are unusual. I am struggling to find a better way to design these. Some background: I am reading…
Mike
  • 649
  • 4
  • 11
5
votes
1 answer

Is there a way to use RAII techniques in COM?

I am caught between two conceptual models of how to construct objects, and am having trouble working out what standard I want to adopt. I prefer to program in .NET and often try to use RAII and read-only properties to make immutable objects with…
Mike
  • 649
  • 4
  • 11
5
votes
2 answers

COM INTEROP Support - which is better? C# or VB

I keep hearing that c# is "better" than vb... but as far as I can see, aside from syntactical differences, both compile down to the same IL. I've found some good articles by googling that explain what the differences are between the two and so I…
dot
  • 531
  • 4
  • 12
3
votes
1 answer

Distributing library which internally using COM library

I would like to create a dll library that will be loading in runtime. The library'll be using internally COM objects with MTA flag. The library will be created in main thread. So I have question: Where there is best place where can I call…
3
votes
1 answer

What's a good strategy to go about registering 2-step hotkeys?

User32.dll exposes a RegisterHotKey function, to register, well, hotkeys: [DllImport("user32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool RegisterHotKey(IntPtr hWnd, IntPtr id, uint fsModifiers, uint…
Mathieu Guindon
  • 1,720
  • 16
  • 33
3
votes
1 answer

Eliminating thread affinity requirements when converting an STA COM object into an MTA COM object

Suppose I need to convert an STA COM object into an MTA object. Single threaded apartments guarantee not just that only one thread will call the object at a time, but that it's always the same thread (thread affinity). I think I understand the…
3
votes
2 answers

COM - with great power comes great responsibility, but at what cost? (looking for advice on coding practices when working with COM)

What is best (or commonly accepted) practice for where to declare COM object variables (scope) and how to handle cleaning them up when using structured error handling? I just spend a whole load of time learning about Garbage Collection and…
2
votes
2 answers

When to turn off Option Strict? Or how to deal with inheritance of COM using Option Strict?

I'm trying develop an add-in for an application using it's API and I have Option Strict turned on. Trying to work with these COM objects is causing multiple compile issues saying Option Strict On disallows implicit conversions from 'typeA' to …
CBRF23
  • 269
  • 2
  • 10
1
vote
2 answers

Do you need elevated privileges at runtime if application uses COM?

I am not familiar with the various options you have when dealing with COM components. A legacy system in our company has published a COM API with a mixed mode dll to allow .NET components to interact with it. It also allows the legacy system to run…
Tormod
  • 311
  • 2
  • 8
1
vote
0 answers

JavaBeans vs. ActiveX: Strategic analysis

JavaBeans and ActiveX both serve the same basic function: to facilitate communication among software components within framework "containers." These containers include Web browsers and other document viewers. Courtesy ActiveX controls and JavaBeans…
Premraj
  • 836
  • 10
  • 17
1
vote
0 answers

Mono: C call into managed with COM Interop

I am trying to design a managed library to implement -what appear to be- unmanaged VST3 plugins. The VST3 plugin interface is a C/C++ interface-based API that is compatible with COM (ref-counting, HRESULT etc.) - but is not COM (no reg, CLSID etc).…
obiwanjacobi
  • 167
  • 4
0
votes
3 answers

Best Way to Access Hardware per COM Serial Port over USB Adapter

We are starting a total new Branch at our firm. I am usually developing database interfaces or internal server/client applications/tools for our company, but I never had to do something with hardware. Szenario My Boss want to sell a device, which…
Ello
  • 144
  • 1
  • 4
1
2