XLL+ Class Library (6.3)

CXlOper::ToBool() Example

CopyC++
//{{XLP_SRC(OperToBoolExample) 
    // NOTE - the FunctionWizard will add and remove mapping code here. 
    //    DO NOT EDIT what you see in these blocks of generated code!
IMPLEMENT_XLLFN3(OperToBoolExample, OperToBoolExample_4, OperToBoolExample_12, 
    "RPA", "UQA", L"OperToBoolExample", 0, L"Arg1,Strict", 0, L"Example", 0, 
    L"Demonstrates COper::ToBool()", 0, L"Argument 1\0If True, then do not att"
    L"empt to convert\0", 0, 0, L"{OperToBoolExample,,,Demonstrates COper::ToB"
    L"ool(),Example,1,128,U,{{0,{Arg1,Value,0,,Argument 1,,,,}},{0,{Strict,Boo"
    L"lean,0,,\"If True, then do not attempt to convert\",,,,}}},{},3,,0,0}", 1)
CXlOper* OperToBoolExample_Impl(CXlOper&, const CXlOper*, BOOL);

extern "C" __declspec(dllexport)
LPXLOPER12 OperToBoolExample_12(LPXLOPER12 Arg1, BOOL Strict)
{
    XLL_FIX_STATE;
    CXlOper xloResult, Arg1__port(Arg1);
    try {
        CXlStructuredExceptionHandler _seh_;
        xloResult.HandleResult(OperToBoolExample_Impl(xloResult, &Arg1__port, 
            Strict));
    }
    catch(const CXlRuntimeException& ex) {
        CXllApp::Instance()->DisplayException(xloResult, ex);
    }
    return xloResult.Ret12();
}
extern "C" __declspec(dllexport)
LPXLOPER4 OperToBoolExample_4(LPXLOPER4 Arg1, BOOL Strict)
{
    XLL_FIX_STATE;
    CXlOper xloResult, Arg1__port(Arg1);
    try {
        CXlStructuredExceptionHandler _seh_;
        xloResult.HandleResult(OperToBoolExample_Impl(xloResult, &Arg1__port, 
            Strict));
    }
    catch(const CXlRuntimeException& ex) {
        CXllApp::Instance()->DisplayException(xloResult, ex);
    }
    return xloResult.Ret4();
}

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

    xloResult = Arg1->ToBool(Strict);
    return xloResult.Ret();
}

Uses

CXlOper::ToBool