Question: Catching errors from a VB ActiveX control in Visual C++ using MFC 
Author Message
 Question: Catching errors from a VB ActiveX control in Visual C++ using MFC

G'day peoples. I'm using an ActiveX control written in VB from a MFC
application (using VC 5.0). The documentation I have for the control says
that it uses "standard VB error handling techniques". The problem is that
the handling of any errors I'm getting doesn't suit my purposes and I'd
like to be able to catch it and handle it differently. The problem is, I
don't know how to catch "Standard VB errors".  I've done some fiddling with
try and catch but the error seems to avoid my catch statement and ends up
at a lower level.

Could some suggest how I could catch this error? The VB code being used to
raise the error is using the err object. One such line is like this:

            Err.Description = "Device not Found on " & m_Port
            Err.Raise vbObjectError + 7

Any hints on how to catch this from VC++ would be much appreciated.

Thanks,

Ian Rowlands

(remove the .nospam off the e-mail address if replying by mail)



Fri, 12 Jan 2001 03:00:00 GMT  
 Question: Catching errors from a VB ActiveX control in Visual C++ using MFC
I dont know whether VB uses IErrorInfo or not. You might want to QueryInterface() the
control for ISupportErrorInfo () and if it does, you might be able to use the
COleException or using try and catch _com_error if you use VC 5 COM support.

--
Girish Bharadwaj  [VC++/MVP]
Please don't send email queries.Post them here.
MS Knowledge base articles : http://support.microsoft.com/support

Quote:

>G'day peoples. I'm using an ActiveX control written in VB from a MFC
>application (using VC 5.0). The documentation I have for the control says
>that it uses "standard VB error handling techniques". The problem is that
>the handling of any errors I'm getting doesn't suit my purposes and I'd
>like to be able to catch it and handle it differently. The problem is, I
>don't know how to catch "Standard VB errors".  I've done some fiddling with
>try and catch but the error seems to avoid my catch statement and ends up
>at a lower level.

>Could some suggest how I could catch this error? The VB code being used to
>raise the error is using the err object. One such line is like this:

>            Err.Description = "Device not Found on " & m_Port
>            Err.Raise vbObjectError + 7

>Any hints on how to catch this from VC++ would be much appreciated.

>Thanks,

>Ian Rowlands

>(remove the .nospam off the e-mail address if replying by mail)



Sat, 13 Jan 2001 03:00:00 GMT  
 Question: Catching errors from a VB ActiveX control in Visual C++ using MFC
I am not sure what you mean by using Try and Catch in VB, it does not use
those as keywords.  So far as catching you can implement it kind of.  Using
your example

Function  SomeFunction() as Boolean
On Error Goto Catch

SomeFunction = True

    ....Some Code

    Err.Description = "Device not Found on " & m_Port
    Err.Raise vbObjectError + 7

SomeFunction = False

Exit Function

Catch:

    ...Error Handling Routine For above Function Here

End Function

Hope this helps you......

Quote:

>G'day peoples. I'm using an ActiveX control written in VB from a MFC
>application (using VC 5.0). The documentation I have for the control says
>that it uses "standard VB error handling techniques". The problem is that
>the handling of any errors I'm getting doesn't suit my purposes and I'd
>like to be able to catch it and handle it differently. The problem is, I
>don't know how to catch "Standard VB errors".  I've done some fiddling with
>try and catch but the error seems to avoid my catch statement and ends up
>at a lower level.

>Could some suggest how I could catch this error? The VB code being used to
>raise the error is using the err object. One such line is like this:

>            Err.Description = "Device not Found on " & m_Port
>            Err.Raise vbObjectError + 7

>Any hints on how to catch this from VC++ would be much appreciated.

>Thanks,

>Ian Rowlands

>(remove the .nospam off the e-mail address if replying by mail)



Sat, 13 Jan 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Developing mfc activex control and using ActiveX SDK-question

2. Key/tab problems using VB ActiveX controls in MFC CView and derived classes or PropertyPage

3. C++ MFC ActiveX / VB Newbie question

4. ActiveX C++ using ActiveX VB

5. Problem using VB 5 activex DLL in a VC++ activex control

6. Very simple question re:ActiveX Control - Visual C/C++

7. Error in opening a recordset in ADO in Visual C++ using MFC OLE

8. accessing objects in a c++ DLL from a c++ activeX control placed in a VB application

9. accessing objects in a c++ DLL from a c++ activeX control placed in a VB application

10. catching divide by zero errors in C Dll used by VB app

11. Question about using ActiveX control in MFC dll

 

 
Powered by phpBB® Forum Software