이 항목은 아직 평가되지 않았습니다.- 이 항목 평가

AfxThrowOleDispatchException

Use this function to throw an exception within an OLE automation function.

void AFXAPI AfxThrowOleDispatchException(
   WORD wCode,
   LPCSTR lpszDescription,
   UINT nHelpID = 0 
);
void AFXAPI AfxThrowOleDispatchException(
   WORD wCode,
   UINT nDescriptionID,
   UINT nHelpID =  -1 
);
wCode

An error code specific to your application.

lpszDescription

Verbal description of the error.

nDescriptionID

Resource ID for the verbal error description.

nHelpID

A help context for your application's help (.HLP) file.

The information provided to this function can be displayed by the driving application (Microsoft Visual Basic or another OLE automation client application).


// Sort is method of automation class CStrArrayDoc
long CStrArrayDoc::Sort(VARIANT* vArray)
{
   USES_CONVERSION;

   // Type check VARIANT parameter. It should contain a BSTR array
   // passed by reference. The array must be passed by reference; it is
   // an in-out-parameter.

   // throwing COleDispatchException allows the EXCEPINFO structure of 
   // IDispatch::Invoke() to set
   if (V_VT(vArray) != (VT_ARRAY | VT_BSTR))
      AfxThrowOleDispatchException(1001, 
         _T("Type Mismatch in Parameter. Pass a string array by reference"));

   // ...
   // ...

   return 0;
}


Header: <afxdisp.h>

이 정보가 도움이 되었습니까?
(1500자 남음)
커뮤니티 콘텐츠 추가