How to write an ActiveX DLL in Visual C++, which I should instantiate in Visual Basic..?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: How to write an ActiveX DLL in Visual C++, which I should instantiate in Visual Basic..?

Hybrid View

  1. #1
    Raj Kumar s Guest

    How to write an ActiveX DLL in Visual C++, which I should instantiate in Visual Basic..?


    Hi
    I've written an ActiveX DLL in Visual C++ with MFC, I'm able to write
    the COM client in Visual C++ which works well. But when I add a reference
    in Visual Basic and try to instantiate, I'm getting an error like
    'ActiveX components can't create objects". I do know why..? shall I need
    to do extra code for working well in Visual Basic.

    Pl. give me a solution, this is so urgent..!!

    Thanks and regards
    Rajkumar
    NUVA Systems Ltd.
    India.

  2. #2
    Ted Guest

    Re: How to write an ActiveX DLL in Visual C++, which I should instantiate in Visual Basic..?


    Is this in-proc or out-of-proc? You have to make sure if it is out-of-proc
    that you have the ps.dll built and registered or generate the appropriate
    .reg script. There is no need to do anything extra to make this work with
    VB. Is your VC++ client using CoCreateInstance or are you using the #import
    directive?

    Make sure that you have the correct code in VB. Make sure that you are using
    the correct coclass. You could look in the .idl or in OLEVIEW to see if
    you are using this correctly.

    "Raj Kumar s" <raj@nuva.com> wrote:
    >
    >Hi
    >I've written an ActiveX DLL in Visual C++ with MFC, I'm able to write
    >the COM client in Visual C++ which works well. But when I add a reference
    >in Visual Basic and try to instantiate, I'm getting an error like
    >'ActiveX components can't create objects". I do know why..? shall I need
    >to do extra code for working well in Visual Basic.
    >
    >Pl. give me a solution, this is so urgent..!!
    >
    >Thanks and regards
    >Rajkumar
    >NUVA Systems Ltd.
    >India.



  3. #3
    Yuri Guest

    Re: How to write an ActiveX DLL in Visual C++, which I should instantiate in Visual Basic..?


    I should set thread model either aprtment or both for your COM object, check
    *.rgs file
    ThreadingModel = s 'Apartment'


    "Raj Kumar s" <raj@nuva.com> wrote:
    >
    >Hi
    >I've written an ActiveX DLL in Visual C++ with MFC, I'm able to write
    >the COM client in Visual C++ which works well. But when I add a reference
    >in Visual Basic and try to instantiate, I'm getting an error like
    >'ActiveX components can't create objects". I do know why..? shall I need
    >to do extra code for working well in Visual Basic.
    >
    >Pl. give me a solution, this is so urgent..!!
    >
    >Thanks and regards
    >Rajkumar
    >NUVA Systems Ltd.
    >India.



  4. #4
    Ted Guest

    Re: How to write an ActiveX DLL in Visual C++, which I should instantiate in Visual Basic..?


    The threading model does not matter with this. The threading model will determine
    who provides thread concurrency, the COM or the developer. The threading
    model will determine also which type of apartment the object is loaded in.
    Be aware if you use the 'BOTH' threading model. There are special precautions
    that have to be taken, IE the Free threaded marshaller and cross apartment
    object access. Unless you know what you are doing do not aggregate the free
    threaded marshaller, it will only bring you grief. Also, I would not use
    the .rgs script as it will help to ease installation procedures if you use
    a proxy/stub instead.

    "Yuri" <putivsky@home.com> wrote:
    >
    >I should set thread model either aprtment or both for your COM object, check
    >*.rgs file
    >ThreadingModel = s 'Apartment'
    >
    >
    >"Raj Kumar s" <raj@nuva.com> wrote:
    >>
    >>Hi
    >>I've written an ActiveX DLL in Visual C++ with MFC, I'm able to write
    >>the COM client in Visual C++ which works well. But when I add a reference
    >>in Visual Basic and try to instantiate, I'm getting an error like
    >>'ActiveX components can't create objects". I do know why..? shall I need
    >>to do extra code for working well in Visual Basic.
    >>
    >>Pl. give me a solution, this is so urgent..!!
    >>
    >>Thanks and regards
    >>Rajkumar
    >>NUVA Systems Ltd.
    >>India.

    >



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