Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 1.98 KB

mfc-activex-controls-returning-error-codes-from-a-method.md

File metadata and controls

25 lines (17 loc) · 1.98 KB
description title ms.date helpviewer_keywords ms.assetid
Learn more about: MFC ActiveX Controls: Returning Error Codes From a Method
MFC ActiveX Controls: Returning Error Codes From a Method
11/04/2016
MFC ActiveX controls [MFC], error codes
SetNotSupported method, using
errors [MFC], ActiveX control error codes
GetNotSupported method [MFC]
FireError method [MFC]
SCODE, MFC ActiveX controls
ThrowError method [MFC]
771fb9c9-2413-4dcc-b386-7bc4c4adeafd

MFC ActiveX Controls: Returning Error Codes From a Method

This article describes how to return error codes from an ActiveX control method.

To indicate that an error has occurred within a method, you should use the COleControl::ThrowError member function, which takes an SCODE (status code) as a parameter. You can use a predefined SCODE or define one of your own.

Note

ThrowError is meant to be used only as a means of returning an error from within a property's Get or Set function or an automation Method. These are the only times that the appropriate exception handler will be present on the stack.

Helper functions exist for the most common predefined SCODEs, such as COleControl::SetNotSupported, COleControl::GetNotSupported, and COleControl::SetNotPermitted.

For a list of predefined SCODEs and instructions on defining custom SCODEs, see the section Handling Errors in Your ActiveX Control in ActiveX Controls: Advanced Topics.

For more information on reporting exceptions in other areas of your code, see COleControl::FireError and the section Handling Errors in Your ActiveX Control in ActiveX Controls: Advanced Topics.

See also

MFC ActiveX Controls