XLL+ Class Library (7.0)

CXlOper::ToDouble() Example

CopyC++
//{{XLP_SRC(OperToDoubleExample) 
    // NOTE - the FunctionWizard will add and remove mapping code here. 
    //    DO NOT EDIT what you see in these blocks of generated code! 
 
#pragma region OperToDoubleExample support code
IMPLEMENT_XLLFN4(OperToDoubleExample, OperToDoubleExample_4, 
    OperToDoubleExample_12, "RPA", "UQA", L"OperToDoubleExample", 0, L"Arg1,St"
    L"rict", 0, L"Example", 0, L"Demonstrates COper::ToDouble()", 0, L"Argumen"
    L"t 1\0If True, then do not attempt to convert\0", 0, 0, L"{OperToDoubleEx"
    L"ample,,,Demonstrates COper::ToDouble(),Example,1,128,U,{{0,{Arg1,Value,0"
    L",,Argument 1,,,,}},{0,{Strict,Boolean,0,,\"If True, then do not attempt "
    L"to convert\",,,,}}},{},3,,0,0,,,,0,0}", 1, 0, 0)
CXlOper* OperToDoubleExample_Impl(CXlOper&, const CXlOper*, BOOL);
extern "C" __declspec(dllexport)
LPXLOPER12 OperToDoubleExample_12(LPXLOPER12 Arg1, BOOL Strict)
{
    XLL_FIX_STATE;
    CXlOper xloResult, Arg1__port(Arg1);
    try {
        CXlStructuredExceptionHandler _seh_;
        xloResult.HandleResult(OperToDoubleExample_Impl(xloResult, &Arg1__port, 
            Strict));
    }
    catch(const CXlRuntimeException& ex) {
        CXllApp::Instance()->DisplayException(xloResult, ex);
    }
    XLP_CATCH_CLR_EXCEPTIONS_TO(xloResult)
    return xloResult.Ret12();
}
extern "C" __declspec(dllexport)
LPXLOPER4 OperToDoubleExample_4(LPXLOPER4 Arg1, BOOL Strict)
{
    XLL_FIX_STATE;
    CXlOper xloResult, Arg1__port(Arg1);
    try {
        CXlStructuredExceptionHandler _seh_;
        xloResult.HandleResult(OperToDoubleExample_Impl(xloResult, &Arg1__port, 
            Strict));
    }
    catch(const CXlRuntimeException& ex) {
        CXllApp::Instance()->DisplayException(xloResult, ex);
    }
    XLP_CATCH_CLR_EXCEPTIONS_TO(xloResult)
    return xloResult.Ret4();
}

#pragma endregion

CXlOper* OperToDoubleExample_Impl(CXlOper& xloResult, const CXlOper* Arg1, BOOL 
    Strict)
{
    // End of generated code 
//}}XLP_SRC 
 
    // Note that ToDouble() will throw an Exception (interrupting execution)  
    // if Strict is TRUE and Arg1 is not a number. 
 
    // This will be caught by the wrapper function, and an error message 
    // will be returned to Excel.

    xloResult = Arg1->ToDouble(Strict ? true : false);
    return xloResult.Ret();
}

Uses

CXlOper::ToDouble