how to return an error code from COM to vb script 
Author Message
 how to return an error code from COM to vb script

Hi guys,

Here is what I have:

here is the IDL def. for my public method
[id(2), helpstring("method SOMETHING")] HRESULT SYNC_USER
([in]BSTR result);

SOMETHING()
has several returns, such as RETURN 1; for example,

how can I get 1 from VB script?

Thank you,
mike



Sun, 23 May 2004 23:15:53 GMT  
 how to return an error code from COM to vb script
You can't. VB and scripts do not distinguish between different success
HRESULTs. Different failed HRESULTs can usually be retrieved through Error
object.

You can make the return value explicit though:

HRESULT SYNC_USER([in]BSTR result, [out, retval] short *pResult);

In VB or script the call will look like this

res = SYNC_USER("string");

In your C++ code, you write

*pResult = 1;
return S_OK;

--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat, and
wrong." H.L. Mencken


Quote:
> Hi guys,

> Here is what I have:

> here is the IDL def. for my public method
> [id(2), helpstring("method SOMETHING")] HRESULT SYNC_USER
> ([in]BSTR result);

> SOMETHING()
> has several returns, such as RETURN 1; for example,

> how can I get 1 from VB script?

> Thank you,
> mike



Mon, 24 May 2004 00:18:10 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem with scripting context when using VB com object inside VC com object

2. COM Interop and VB Script

3. CGI script returning a GIF and HTML code (written in C)

4. Byte Array returned from ATL COM Server to VB app

5. Returning a value from a VC++ COM to VB

6. can't get return codes to VB

7. Returning IDispatch from VB code

8. Returning[out,retval] interface to VB error

9. How return error to VB client?

10. Return Standard VB Error

11. Returning Error to VB Client

12. i need this VB code in c# -- calling COM obj

 

 
Powered by phpBB® Forum Software