How to call not a default constructor in COM Server?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: How to call not a default constructor in COM Server?

  1. #1
    Krassimir Boyanov Guest

    How to call not a default constructor in COM Server?


    Hello,
    I have ATL COM Server, build in VStudio.
    The server has a class with 2 constructors(one is the default, the other
    has one parameter).
    I am using the COM object from VB (CreateObject), but it is calling each
    time the default constructor for the class implementing the interface.

    How can I create the object, using the second constructor from withing VB?

    Thanks in advance,
    Krassimir

  2. #2
    Willy Van den Driessche Guest

    Re: How to call not a default constructor in COM Server?

    I'm not the guru, but I guess you can't. COM instantiation doesn't let you
    use parameterized constructors. You need to define an additional interface
    yourself with something like an 'initialize method'.

    --
    Van den Driessche Willy
    For a work in progress :
    http://users.skynet.be/wvdd2/index.html
    "Krassimir Boyanov" <kboyanov@printrak.com> wrote in message
    news:3ba28941$1@news.devx.com...
    >
    > Hello,
    > I have ATL COM Server, build in VStudio.
    > The server has a class with 2 constructors(one is the default, the other
    > has one parameter).
    > I am using the COM object from VB (CreateObject), but it is calling each
    > time the default constructor for the class implementing the interface.
    >
    > How can I create the object, using the second constructor from withing VB?
    >
    > Thanks in advance,
    > Krassimir




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center