XLL+ Class Library

Step 1 - Remove argument cache

Remove argument cache

The built-in argument cache (generated by the XLL+ AppWizard) is no longer required and should be removed.

In AvgOpt.h, remove the two lines shaded below.

class CAvgOptApp : public CXllApp
{
public:
    CAvgOptApp();

// Names
public:
    static LPCSTR m_pszDefName;

// Data
    CXlOperCache m_cache;    
    CString m_strCacheFile;  

// Menu
    CXlMenu m_menu;

    ...
};

In AvgOpt.cpp, remove the lines shaded below.

BOOL CAvgOptApp::OnXllOpenEx()
{
    // Calculate the full path of the cache data file.                            
    // This is the same as the add-in, with the extension "dat".                  
    m_strCacheFile = CXllApp::GetXllName();                                       
    m_strCacheFile = m_strCacheFile.Left(m_strCacheFile.GetLength() - 3) + "dat"; 

    // Restore cache, ignoring failure                                            
    m_cache.Restore(m_strCacheFile);                                              

    // Set up menu
    m_menu.SetTexts("&AvgOpt");
    m_menu.AddItem("&Clear cache", "AvgOptClearCache");
    m_menu.Create();

    return TRUE;
}

void CAvgOptApp::OnXllClose()
{
    // Save cache                          
    m_cache.Save(m_strCacheFile);          

    // Delete menu
    m_menu.Destroy();
}

Use the XLL+ Function Wizard to switch off the argument cache for the AvgOptValue function in AvgOpt.cpp:

This will remove all of the generated code within the add-in function that supports the argument cache.

Next: Step 2 - Insert AvgOptDataCache >>