Board index » cppbuilder » Problem using ActiveX dll

Problem using ActiveX dll

Hi,

i wrote an AX dll in VB and try to use it in BCB4. what i tried is:

[VB, Project1, Class1]
Public Sub MyMsgBox(msg As String)
    MsgBox msg, , "vb test"
End Sub

[BCB, Button1Click()]
{
    Class1 *a;

    a = new Class1( );
    a->MyMsgBox(Variant("Test"));

Quote
}

Compiler stops at "a=new Class1()", and the error is:
[C++ Error] Unit1.cpp(21): E2352 Cannot create instance of abstract class
'_Class1'.
[C++ Error] Unit1.cpp(21): E2353 Class '_Class1' is abstract because of
'__stdcall _Class1::MyMsgBox(wchar_t * *) = 0'.

i looked at the code in Project1_TLB.h and i found the virtual function, and
i just stupidly remove "= 0". this time the compiler shows:
[C++ Error] Unit1.cpp(21): E2352 Cannot create instance of abstract class
'_Class1'.
[C++ Error] Unit1.cpp(21): E2353 Class '_Class1' is abstract because of
'__stdcall IDispatch::GetTypeInfoCount(unsigned int *) = 0'.

What is the problem and how to correct it?  Thanks!!

Best regards,
Alex

 

Re:Problem using ActiveX dll


That's right. You can't instantiate the COM objects using C++ notation.
You need to use COM functions to obtain a pointer to a COM object.

.a

Quote
Alex wrote:

[snip]

Other Threads