COM objects

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • An Ony

    #1

    COM objects

    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\Quote sDLL.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!


  • An Ony

    #2
    Re: COM objects

    > >now I try to compile it, in debug mode all goes well, but I get:[color=blue][color=green]
    > >RegAsm warning: No types were registered
    > >Assembly exported to '...\QuotesDLL\ bin\Debug\Quote sDLL.tlb', and the[/color][/color]
    type[color=blue][color=green]
    > >library was registered successfully[/color]
    >
    > See if it helpst to mark the QuoteSystem class with
    > [ComVisible(true )].
    >[/color]

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


    Comment

    Working...