
#include <owl\applicat.h>
class TMyApplication: public TApplication
{
public:
TMyApplication(const char far* name = 0) : TApplication(name) {}.
.
.
};
ObjectWindows 2.0 applications don’t require an explicit WinMain
function; the ObjectWindows libraries provide one that performs error
handling and exception handling. Y u can perform any initialization youo
want in the OwlMain function, which is called by the default WinMain
function.
T construct an application object, create an instance of your applicationo
class in the OwlMain function. The following example shows a simple
application object’ definition and instantiation:s
#include <owl\applicat.h>
class TMyApplication: public TApplication
{
public:
TMyApplication(const char far* name = 0): TApplication(name) {}
};
int
OwlMain(int argc, char* argv[])
{
return TMyApplication("Wow!").Run();
}
ObjectWindows 2.0 provides a default WinMain function that provides
Using WinMain and
extensive error checking and exception handling. This WinMain function
OwlMain
sets up the application and calls the OwlMain function.
Although you can use your own WinMain by placing it in a source file,
there’ little reason to do so. Everything you would otherwise do ins
WinMain you can do in OwlMain or in T pplication initialization memberA
functions. The following example shows a typical use of OwlMain in an
application:
#include <owl\applicat.h>
#include <string.h>
122
OWL P ogrammer’ Guider s