Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NULL returned from COM dll crashes VB app.

Status
Not open for further replies.

TheMillionDollarMan

Programmer
Jun 10, 2002
132
US

Hi,

We have an application written in C++. We have exposed some of the objects in a COM dll.

Now when the VB application calls one of the methods in the COM dll that returns a NULL the VB application blows up.

Normally when using the same method in C++ we can handle the NULL return type no problem.

How can we handle the null return type?
1. Change all of the methods in the C++ object so that they never return a null.

2. set one of the project configurations? NMAKE?

3. Avoid the VB application calling the NULL returning methods. Not feasible as its a distributed software component.

I would like some suggestions as there are 1000's of methods and I don't want to have to code the

return MethodMayReturnNull() = NULL : 0 : MethodMayReturnNull();

Thanks..

 
>> Now when the VB application calls one of the methods in
>> the COM dll that returns a NULL the VB application
>> blows up.

I don't understand. VB uses IDispatch

HRESULT Invoke(
DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS FAR* pDispParams,
VARIANT FAR* pVarResult,
EXCEPINFO FAR* pExcepInfo,
unsigned int FAR* puArgErr
);


So your code returns NULL for the HRESULT? It's not supposed to do that.

-pete

 
Whoops.

Sorry you're right. My problem is that the C++ object is returning NULL and causing the problem.

Thanks for you're help anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top