By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,353 Members | 1,256 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,353 IT Pros & Developers. It's quick & easy.

Need a COM expert

P: n/a
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


Jan 4 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,
>Should I always assume VB.NET inverts HRESULT returns?
Why should VB.NET invert HRESULT's? This makes no sense!
See the HRESULT Data Type Layout:
http://en.wikipedia.org/wiki/HRESULT
and look at the links at the bottom of the page!

See this:
http://msdn2.microsoft.com/en-us/lib...25(VS.80).aspx

and this:
http://msdn2.microsoft.com/en-us/lib...s1(VS.80).aspx
Regards
Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Jan 4 '08 #2

P: n/a
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

Jan 4 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.