Application initialization and termination
The functions in this section are used on application startup/shutdown and also
to control the behaviour of the main event loop of the GUI programs.
This initializes wxWindows in a platform-dependent way. Use this if you
are not using the default wxWindows entry code (e.g. main or WinMain). For example,
you can initialize wxWindows from an Microsoft Foundation Classes application using
, HANDLE hPrevInstance
const wxString& commandLine
, int cmdShow
, bool enterLoop = TRUE
wxWindows initialization under Windows (non-DLL). If enterLoop is FALSE, the
function will return immediately after calling wxApp::OnInit. Otherwise, the wxWindows
message loop will be entered.
, HANDLE hPrevInstance
, WORD wHeapSize
, const wxString& commandLine
wxWindows initialization under Windows (for applications constructed as a DLL).
, const wxString& * argv
wxWindows initialization under Unix.
To clean up wxWindows, call wxApp::OnExit followed by the static function
wxApp::CleanUp. For example, if exiting from an MFC application that also uses wxWindows:
// OnExit isn't called by CleanUp so must be called explicitly.
bool wxHandleFatalExceptions(bool doIt = TRUE)
is TRUE, the fatal exceptions (also known as general protection
faults under Windows or segmentation violations in the Unix world) will be
caught and passed to wxApp::OnFatalException
By default, i.e. before this function is called, they will be handled in the
normal way which usually just means that the application will be terminated.
Calling wxHandleFatalExceptions() with doIt
equal to FALSE will restore
this default behaviour.
Initializes all available image handlers. For a list of available handlers,
This function is used in wxBase only and only if you don't create
object at all. In this case you must call it from your
function before calling any other wxWindows functions.
If the function returns FALSE
the initialization could not be performed,
in this case the library cannot be used and
shouldn't be called neither.
This function may be called several times but
must be called for each successful
call to this function.
(wxWindow* win = NULL
onlyIfNeeded = FALSE
This function is similar to wxYield, except that it disables the user input to
all program windows before calling wxYield and re-enables it again
afterwards. If win is not NULL, this window will remain enabled,
allowing the implementation of some limited user interaction.
This function is for use in console (wxBase) programs only. It must be called
once for each previous successful call to wxInitialize
This function is kept only for backwards compatibility. Please use
method instead in any new code.
<wx/app.h> or <wx/utils.h>
This functions wakes up the (internal and platform dependent) idle system, i.e. it
will force the system to send an idle event even if the system currently is
idle and thus would not send any idle event until after some other event would get
sent. This is also useful for sending events between two threads and is used by
the corresponding functions ::wxPostEvent