Method Return Values

For each interface method there are two prototypes shown, each of which has the [VB] or [C++] notation beside it. The method prototypes return different values depending on which language is used.

Return Values For Microsoft Visual Basic

The return value is usually handled by a variant data structure that will automatically handle whatever type is returned. A method call would be as follows:

Dim HashAlgorithmValue As VARIANT  'return value

HashAlgorithmValue = get_HashAlgorithm( )
 

In this example code fragment, the return variable HashAlgorithmValue would be accepting a BSTR.

Return Values For Microsoft C++

The return value is always of type HRESULT, and it is from this return value that it can be determined whether or not the method or property call succeeded, and if not, what the error was. Programmatic values that need to be returned are returned through "output" parameters in the method. The following example shows a C++ method call to retrieve a request attribute:

ICEnroll*     iXenroll = NULL;
UINT          ucEnumProvIndex = 0;
BSTR          bstrProviders = NULL;
HRESULT       hr;

iXenroll = GetInterface();
hr       = iXenroll->enumProviders(ucEnumProvIndex, 0, &bstrProviders);
 

In the preceding code fragment, success or failure is returned to the "hr" variable.