Component not working in VB.
Hi,
I created a very simple ATL component using application wizard. I used
IDispatch interface also for VB. But If I try to use following code in
VB, its giving me error saying, "ActiveX Component cant create object"
My VB Code is,
Dim testATL4obj As Object
Private Sub Command1_Click()
testATL4obj.methodTestATL42 (22)
End Sub
Private Sub Form_Load()
testATL4obj = CreateObject("TESTATL4Lib.classTestATL4")
End Sub
===================================
my IDL says something like this,
interface IclassTestATL4 : IDispatch
{
[id(1), helpstring("method methodTestATL41")] HRESULT
methodTestATL41(BSTR name, long age);
[id(2), helpstring("method methodTestATL42")] HRESULT
methodTestATL42(long age);
};
and Library section says like,
library TESTATL4Lib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(1679D055-01B2-491E-B7EE-7287107FA304),
helpstring("_IclassTestATL4Events Interface")
]
dispinterface _IclassTestATL4Events
{
properties:
methods:
};
[
uuid(42802B24-AD1C-4B12-AD82-586006D9C8A2),
helpstring("classTestATL4 Class")
]
coclass classTestATL4
{
[default] interface IclassTestATL4;
[default, source] dispinterface _IclassTestATL4Events;
};
};
//I dont fire any events right now..
If I try to use the same COM Server in VC++, it returns error saying
[0x80040154] Class not registered. I also tried to register the DLL by
using regsvr32. But the same result. What is wrong with my code ?