Questions tagged [coclass]
12 questions
45
votes
1 answer
What does the C# CoClass attribute do?
I found code something like the following in a 3rd party library we're using.
[CoClass(typeof(BlahClass))]
public interface Blah : IBlah
{
}
What is this doing exactly? The msdn documentation didn't illuminate the subject sufficiently for me to…

Robert Gowland
- 7,677
- 6
- 40
- 58
9
votes
1 answer
Why is it possible to create a new instance of a COM interface?
I don't have very much background regarding COM nor coclasses, so I don't quite understand why I can use the new operator with an interface. From a language/framework-agnostic view, it's confusing why this compiles and runs correctly:
using…

ide
- 19,942
- 5
- 64
- 106
6
votes
1 answer
How to define implementation of a COM coclass?
I am new to COM, and I looked around on the internet to find how to create a COM class in C++ (to be used by C#). I've seen that in the .idl file, I must put something like…

Carl
- 1,224
- 2
- 19
- 35
4
votes
2 answers
Is it ok to (ab)use CoClassAttribute to provide a default implementation for an interface?
I recently discovered that it's possible to "new up" an interface in C# by decorating the interface with the CoClassAttribute to specify a default implementation.
[ComImport, Guid("579A4F68-4E51-479A-A7AA-A4DDC4031F3F"),…

Ani
- 111,048
- 26
- 262
- 307
4
votes
0 answers
Why would tlbimp convert interfaces to coclasses?
It's in fact a feature that in most cases tlbimp will convert an interface to a coclass. Specifically if in IDL I have
interface IFirst {
}
interface ISecond {
HRESULT GetFirst( IFirst** );
}
coclass First {
interface IFirst;
}
then tlbimp…

sharptooth
- 167,383
- 100
- 513
- 979
2
votes
1 answer
Unable to cast COM object of type 'System.__ComObject' to class type AgentInfo
I have two C# projects, one is a dll and another is a windows forms app.
I have a CoClass defined in the dll as follows` '
[ComVisible(true),
Guid("1620BE13-A68F-4FA3-B5C8-31092D626CDA"),
ProgId("AgentDLLServer.AgentInfo"),
…

Sagar Kapadia
- 105
- 1
- 9
2
votes
1 answer
COM coclass implementing interface from another type library
I'm relatively new in COM, so appologies if this is a stupid question. I'm having a bunch of COM interfaces compiled into a type library A. This type library is a resource in one of the DLLs (a.dll) in my solution. In a separate type library (B)…

themik81
- 401
- 6
- 17
1
vote
1 answer
Class not registered in Delphi XE7
I am using com .dll within my Delphi application.
for this I registered my com .dll using regsvr32.exe .dll name command.
It registered fine and then i converted this com .dll to type library (.tlb pas file).
So now I am using this .tlb pas file to…

Ankush
- 89
- 1
- 1
- 8
1
vote
1 answer
Difference between Inspector and InspectorClass
I've been looking at the VSTO libraries, mostly for the fun of it, and I noticed that there's something called Inspector as well as InspectorClass.
What's the difference, why is it there and how can I put it to use? (NB I'm not looking for an answer…
user1675891
0
votes
1 answer
Why is no ProgId generated for these ATL Simple Objects?
I have an ATL DLL with a bunch of ATL Simple Objects (= COM objects), all wizard-generated.
The IDL file contains lots of interfaces and a library section such as this:
[
object,
uuid(00000000-0000-0000-0000-000000000000),
dual,
…

Felix Dombek
- 13,664
- 17
- 79
- 131
0
votes
0 answers
Interop not creating coclass
I have a legacy COM component which I need wrap and use in .NET code. When I used the tlbimp to create the RCW for the component just one interface had a coclass created to which I was able to make a call.
Rest five or so interface does not have a…

Pacchy
- 73
- 11
0
votes
1 answer
Why might newly added COM methods not be called from document?
I'm writing a BHO that exposes a number of methods through COM. Most of them work fine, but the 2 most recently added ones are showing strange behavior.
When called from JavaScript on a page, the newly added methods "return" Undefined, as opposed to…

BrMcMullin
- 1,261
- 2
- 12
- 28