COM objects

A

An Ony

First time I tried to write a COM object.
I'm having this as code:
================================================>
....
namespace QuotesDLL
{
[Guid("53D4E200-38B0-4925-9708-A96484BAF822")]
public interface QuoteInterface
{
[DispId(1)]
bool addQuote(string quote);
[DispId(2)]
string getQuote(string [] args);
[DispId(3)]
string getQuote();
}

[Guid("F4A45909-85FE-496c-AC5D-39380B92DE23")]
public class QuoteSystem : QuoteInterface
{ ...
<=================================================
that's all good, right? Those methods in the interface are made public in
the implementation. Does it hurt to make other methods private? addQuote()
uses saveQuotes() and that's declared private, that's not interfering with
the whole "COM object"-idea, is it?

now I try to compile it, in debug mode all goes well, but I get:
RegAsm warning: No types were registered
Assembly exported to '...\QuotesDLL\bin\Debug\QuotesDLL.tlb', and the type
library was registered successfully

trying to compile it in Release mode, I get a build error:
COM Interop registration failed. There are no registrable types in the built
assembly.

manual run on the debug dll:
RegAsm warning: No registry script will be produced since there are no types
to register

I've checked the registry and I can find the interfaceid, but not the class
that implements the interface.
I have no experience whatsoever with writing COM objects, so I don't know
what to do or what goes wrong.


And on final level, how do I call the COM object using mIRC? The command
works as follows:
/comopen name progid
name: some name for the connection
but what is progid in this case? QuotesDLL? QuoteSystem? QuoteInteface? The
upper hex number or the lower hex number?


thx so much!
 
A

An Ony

now I try to compile it, in debug mode all goes well, but I get:
RegAsm warning: No types were registered
Assembly exported to '...\QuotesDLL\bin\Debug\QuotesDLL.tlb', and the type
library was registered successfully

See if it helpst to mark the QuoteSystem class with
[ComVisible(true)].

still the same
and why do I get a different error on the Release-configuration build?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top