Passing Err.Number to VB from C++ 
Author Message
 Passing Err.Number to VB from C++

How do I "throw" an error in C++ / ATL and allow VB to retrieve
Err.Number?  There seems only to be a way to send a text description
using the ATL Error functions.

Presently, I'm doing this...

return Error("Whoa thar!", IID_IMyClass, 0);



Sun, 11 Jul 2004 13:18:47 GMT  
 Passing Err.Number to VB from C++
return Error("Whoa thar!", IID_IMyClass, hr);

where hr is an HRESULT.  This can be a variable tossed from another function
or one of your own, like E_POINTER, E_FAIL, or E_INVALIDARG.  You can make
up your own if you really insist, but I feel it's best to use the built-in
ones if you're doing a COM for the mid tier.

-Dale


Quote:
> How do I "throw" an error in C++ / ATL and allow VB to retrieve
> Err.Number?  There seems only to be a way to send a text description
> using the ATL Error functions.

> Presently, I'm doing this...

> return Error("Whoa thar!", IID_IMyClass, 0);



Sun, 11 Jul 2004 13:42:02 GMT  
 Passing Err.Number to VB from C++
You can use AtlReportError to specify more error information

Jaime



Quote:
> How do I "throw" an error in C++ / ATL and allow VB to retrieve
> Err.Number?  There seems only to be a way to send a text description
> using the ATL Error functions.

> Presently, I'm doing this...

> return Error("Whoa thar!", IID_IMyClass, 0);



Sun, 11 Jul 2004 18:55:40 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Raising an error to VB, setting Err.Number

2. Catching err.raise of a VB control in an MFC app

3. ATL Component: Err object in VB???

4. Trouble Catching Exception In MFC From A VB Err.Raise

5. pass vb.net function pointer to Managed C++

6. How to pass an ADODB.Stream object from VB to a method in a C++ component

7. Passing Arrays to and from VB/C++ ATL

8. Passing arrays of UDT between VB and C++

9. C++ Event needs string arg that can be passed to VB

10. Passing constants from VB to a C++ DLL

11. function parameters to pass a VB string array to a C++ DLL

12. Passing Arrays from VB to C++ and Back

 

 
Powered by phpBB® Forum Software