An option value calculator add-in, which runs lengthy calculations in a background thread
The code in this add-in demonstrates the steps in the old User Guide topic Multi-thread add-ins using RTD. All this functionality can be achieved without coding, using the improved asynchronous function model described in Asynchronous functions.
For the up-to-date version of this sample, see the AvgOptAsync2 sample, which was produced from AvgOpt using the XLL+ Function Wizard, but without any extra code being written.
This add-in contains a calculator for calculating the value of a complex option. The code is based on the single-threaded sample AvgOpt.
The calculation of the option value is very slow (since it uses a Monte-Carlo algorithm) and it may therefore be worthwhile running the calculation in a background thread. Excel remains fully available and responsive while the calculations run.
The spreadsheet is only updated when a calculation has finished, and the
results are available. Until the calculation completes, the result #WAIT!
is displayed.
Full details of this sample are contained in the User Guide.
CXlOper::Ret | CXlMenu | CXlMenu::SetTexts | CXlMenu::AddItem | CXlMenu::Create | CXlMenu::Destroy | CXllApp::WinMessageBox | ::XllGetTypedApp
Each sample project is located in a sub-directory of the Samples directory of the XLL+ installation. To use the sample project, open the solution file AvgOpt.sln or the project file AvgOpt.vcproj.
You can enable debugging under Excel by using the Setup Debugging command in the XLL+ ToolWindow.
When delivered, the help files are excluded from the build.
You can enable the help build by selecting the files
AvgOpt.help.xml
and
AvgOpt.chm
in the Solution Explorer,
and using the right-click menu to view Properties.
Select the page "Configuration Properties/General" and
set the "Excluded from build" property to "No".
See Generating help
in the User Guide for more information.