This example shows how create a CXlOper return value from a string.
// Function: MyUpper // Returns: LPXLOPER // Description: Returns the input string converted to upper-case //{{XLP_SRC(MyUpper) // NOTE - the FunctionWizard will add and remove mapping code here. // DO NOT EDIT what you see in these blocks of generated code! IMPLEMENT_XLLFN3(MyUpper, MyUpper_4, MyUpper_12, "RC", "UC%", L"MyUpper", 0, L"Input", 0, L"14", 0, L"Returns the input string converted to upper-case", 0, L"Input string\0", 0, 0, L"{MyUpper,,,Returns the input string converte" L"d to upper-case,14,1,128,U,{{0,{Input,String,0,,Input string,,,,}}},{},3" L",,0,0}", 1) CXlOper* MyUpper_Impl(CXlOper&, const CXlStringArg&); extern "C" __declspec(dllexport) LPXLOPER12 MyUpper_12(const XCHAR* Input) { XLL_FIX_STATE; CXlOper xloResult; CXlStringArg Input__port(Input); try { CXlStructuredExceptionHandler _seh_; xloResult.HandleResult(MyUpper_Impl(xloResult, Input__port)); } catch(const CXlRuntimeException& ex) { CXllApp::Instance()->DisplayException(xloResult, ex); } return xloResult.Ret12(); } extern "C" __declspec(dllexport) LPXLOPER4 MyUpper_4(const char* Input) { XLL_FIX_STATE; CXlOper xloResult; CXlStringArg Input__port(Input); try { CXlStructuredExceptionHandler _seh_; xloResult.HandleResult(MyUpper_Impl(xloResult, Input__port)); } catch(const CXlRuntimeException& ex) { CXllApp::Instance()->DisplayException(xloResult, ex); } return xloResult.Ret4(); } CXlOper* MyUpper_Impl(CXlOper& xloResult, const CXlStringArg& Input) { // End of generated code //}}XLP_SRC CString stIn(Input); stIn.MakeUpper(); xloResult = stIn; return xloResult.Ret(); }