Respond to an event
virtual void Update( CXllOpenEventArgs* e ); |
A pointer to an event arguments object is sent to the Update method.
Derived classes should implement this function, which is the event handler for the XLL+ event model.
The code below defines a class derived from CXllOpenEventStaticObserver, implements an Update method which is called when the event occurs, and instantiates an instance of the new class.
Note that this particular Update method uses CXllOpenEventArgs::SetCancel to cancel the open event for the XLL.
// Define a class derived from CXllOpenEventStaticObserver class CMyOpenEventObserver : CXllOpenEventStaticObserver { public: // This method will be called during the XllOpen event. virtual void Update(CXllOpenEventArgs* e) { CXllApp::XlMessageBox( _T("The event observer will now cancel the XllOpen event"), XlMessageBoxTypeInformation); e->SetCancel(true); } }; // Create an instance of the class CMyOpenEventObserver myOpenObserver;
Header: xlpevents.h
CXllOpenEventStaticObserver Class | CXllOpenEventStaticObserver Methods