.\" This is a wxWidgets manpage page generated from the XML docs .TH wxModule 3wx 2005-02-15 "wxWidgets" "wxWidgets class documentation" .SH NAME wxModule \- .SH DESCRIPTION The module system is a very simple mechanism to allow applications (and parts of wxWidgets itself) to define initialization and cleanup functions that are automatically called on wxWidgets startup and exit. To define a new kind of module, derive a class from wxModule, override the OnInit and OnExit functions, and add the DECLARE_DYNAMIC_CLASS and IMPLEMENT_DYNAMIC_CLASS to header and implementation files (which can be the same file). On initialization, wxWidgets will find all classes derived from wxModule, create an instance of each, and call each OnInit function. On exit, wxWidgets will call the OnExit function for each module instance. Note that your module class does not have to be in a header file. For example: // A module to allow DDE initialization/cleanup // without calling these functions from app.cpp or from // the user's application. class wxDDEModule: public wxModule { DECLARE_DYNAMIC_CLASS(wxDDEModule) public: wxDDEModule() {} bool OnInit() { wxDDEInitialize(); return true; }; void OnExit() { wxDDECleanUp(); }; }; IMPLEMENT_DYNAMIC_CLASS(wxDDEModule, wxModule) .SH "PARENTS" wxObject .SH "INCLUDE FILES" wx/module.h .SH MEMBERS .SS wxModule () Constructs a wxModule object. .SS ~wxModule () Destructor. .SS virtual void OnExit () Provide this function with appropriate cleanup for your module. .SS virtual bool OnInit () Provide this function with appropriate initialization for your module. If the function returns false, wxWidgets will exit immediately. .SH "SEE ALSO" wxObject .SH "AUTHORS" Documentation content by Julian Smart, Robert Roebling, Vadim Zeitlin, Robin Dunn, et al Conversion to manpage format by Arnout Engelen (http://bzzt.net), bugreports welcome.