This example returns an array containing a row of data about each function in the add-in library.
//{{XLP_SRC(GetFunctionList)
// NOTE - the FunctionWizard will add and remove mapping code here.
// DO NOT EDIT what you see in these blocks of generated code!
IMPLEMENT_XLLFN2(GetFunctionList, "R!", "GetFunctionList", "",
"Demo functions", "Returns a list of all the functions"
" contained in this add-in", "", "", 1)
extern "C" __declspec( dllexport )
LPXLOPER GetFunctionList()
{
CXlOper xloResult;
//}}XLP_SRC
// Get an in-scope pointer to the application object
XLL_FIX_STATE;
CXllApp* papp = XllGetApp();
// Create the result buffer
xloResult.AllocArray(papp->GetFnCount(), 7);
// Iterate through each function
// Write its properties into a row of the output array
CXllApp::POSITION pos;
CString sKey;
CXllFn* pfn;
USHORT usRow;
for ( usRow = 0, pos = papp->GetStartFnPosition(); pos; usRow++)
{
papp->GetNextFnAssoc(pos, sKey, pfn);
xloResult.Cell(usRow, 0) = pfn->m_stName;
xloResult.Cell(usRow, 1) = pfn->m_stArgNames;
xloResult.Cell(usRow, 2) = pfn->m_stCategory;
xloResult.Cell(usRow, 3) = pfn->m_stHelpText;
xloResult.Cell(usRow, 4) = (double)pfn->m_usType;
xloResult.Cell(usRow, 5) = pfn->m_stEntryPoint;
xloResult.Cell(usRow, 6) = pfn->m_stArgTemplate;
}
// Return the array
return xloResult.Ret();
}
CXllApp::GetNextFnAssoc | CXllApp::GetFnCount | CXllApp::GetStartFnPosition