Need a COM expert

  • Thread starter Thread starter Academia
  • Start date Start date
A

Academia

I'm using ITextRange::FindText Method
and it works OK but I have to code so that if the return is
not equal to S_OK means it succeeded.

Does VB.NET do some thing to the HRESULT before I get it?

Should I always assume VB.NET inverts HRESULT returns?

Thanks
 
I think I know what is confusing me.

The ITextRange::FindText

....

STDMETHODIMP FindText(
BSTR bstr,
long Count,
long Flags,
long *pLength
);

....

Return Value

The method returns an HRESULT value. If the method succeeds, it returns
S_OK. If the method fails, it returns S_FALSE. For more information about
Component Object Model (COM) error codes, see Error Handling.

...

But I think VB is returning pLenght

If that makes sense to you I really appeciate an explanition.

The second site you mentioned says:
COM methods that regularly return two or more different success codes, such
as S_OK or S_FALSE, cannot be distinguished.

Which I don't understand



and it says:

All Visual Studio SDK interop methods are of int type. HRESULT values are
passed through the interop layer without alteration and without generating
exceptions.

Seems not to be what I see!



So what is confusing me (I think) is I don't know how VB converts FindText
to what looks like a Class method.





Thanks for replying
 
Back
Top