Add new method/ Modify .odl file: control not coming to the new method while debugging

Hello,

I have got a requirement to add a new display method in activex. I have added that and modified the .odl. When I debugged the activex using ActiveXtestContainer, it is found that the new method is displaying fine but  the control is not coming to the new method when invoked..All other existing methods were working..I have randomly given the id as 30 as uptil 29 was allocated. The code sample of the way I have tried is given..

When I checked the folder it is found that, the tlb, and res files have been created and it was by midl /mktyplib203.

Can any body help to figure out what is wrong and why its not debugging the new method added..Did I miss any thing..

Thanks In advance..
//test.odl : part of added code in .odl
dispinterface _programctrl
{
[id(30)] boolean newmethod(BSTR var1,BSTR var2, BSTR var3, BSTR var4, BSTR var5);
}
 
//
 
//testpgm.cpp : part of added code in cpp
DISP_FUNCTION(testcontrl, "newmethod", newmethod, VT_BOOL, VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR)
 
//
BOOL testpgm::newmethod(LPCTSTR var1,LPCTSTR var2,LPCTSTR var3,LPCTSTR var4,LPCTSTR var5) 
{
 
return TRUE;
}
 
//
//testpgm.h : part of added code in h
dispidnewmethod = 30L

Open in new window

LVL 1
EpurchaseAsked:
Who is Participating?
 
EpurchaseConnect With a Mentor Author Commented:
I have resolved the issue finally with the following changes to the code given..

What I found was the DISP_FUNCTION usage couldn't exactly trace the id of the method..Instead when I used DISP_FUNCTION_ID, it started working..I have noticed that the DISP_FUNCTION_ID call having a parameter option to pass dispid of the method as well..Not sure why the DISP_FUNCTION couldn't work but anyhow my issue got resolved with DISP_FUNCTION_ID..

Similarly in the .h file I have changed 30L to just 30. Rest all are same..

Thanks,

//changed part of the code in testpgm.cpp 
 
DISP_FUNCTION_ID(testcontrl, "newmethod",dispidnewmethod, newmethod, VT_BOOL, VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR)
 
//changed part in testpgm.h :
public:
enum{ 
dispidnewmethod = 30, ..

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.