getting the HRESULT from a C++ COM Interface method 
Author Message
 getting the HRESULT from a C++ COM Interface method

Hello all,

    I have created a C++ COM component that exposes several methods from one
interface. All of these methods return a HRESULT. The problem is, that when
I call these methods from a VB app, the methods do not support returning
anything. So if I try to say i = object.method(), I get syntax errors.

I am hoping there is some way to be able to fix this, besides returning the
HRESULT as an out parameter in the function.

Thanks in advance for any help!

-Matt



Fri, 27 Sep 2002 03:00:00 GMT  
 getting the HRESULT from a C++ COM Interface method

Quote:
>    I have created a C++ COM component that exposes several methods from one
>interface. All of these methods return a HRESULT. The problem is, that when
>I call these methods from a VB app, the methods do not support returning
>anything. So if I try to say i = object.method(), I get syntax errors.

>I am hoping there is some way to be able to fix this, besides returning the
>HRESULT as an out parameter in the function.

Matt,

VB will handle the returned HRESULT for you behind the scenes. If you
return a failure code, an error will be raised in VB. If you return a
success code, nothing will happen.

If you want access to a returned HRESULT from VB, you have two
options. One is to return it as an out parameter, just like you said.
The other is to create an alternate type library for the component for
use with VB, where all HRESULT return types are replaced by long.

Mattias

__________________________________________________

     VB+ http://hem.spray.se/mattias.sjogren/
 Please send questions/replies to the newsgroups



Sat, 28 Sep 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Querying COM Interfaces From VB Like You Can In C++

2. Invoking a method in a Visual Basic COM component from C++

3. Getting Data from C++ COM Object

4. get an HRESULT from c++ dll

5. HRESULT from COM

6. Getting HRESULT Parameters in VBS

7. Sometimes GetActiveObject gets HRESULT 0x80070776

8. Newbiw COM Question - COM Interface?

9. Confused by COM terminology: interfaces, coclasses, and COM classes

10. COM Interfaces, VB6 COM Servers, Automation Clients

11. Remove Interface Methods from class methods

12. visual C++ method that's equivalent to usercontrol.asyncread method in vb

 

 
Powered by phpBB® Forum Software