[Contents] [Prev] [Next]

Step 1: Creating a basic application

To begin the tutorial, open the file STEP01.CPP, which shows an example of the most basic useful ObjectWindows application. Because of its brevity, the entire file is shown here: You can find the source for Step 1 in the file STEP01.CPP in the directory EXAMPLES\OWL\TUTORIAL.

//-----------------------------------------------------------------------
// ObjectWindows - (C) Copyright 1991, 1994 by Borland International
// Tutorial application -- step01.cpp
//-----------------------------------------------------------------------
#include <owl/applicat.h>
#include <owl/framewin.h>

Class TDrawApp : public TApplication
{
  public:
    TDrawApp() : TApplication() {}

    void InitMainWindow()
    {
        SetMainWindow(new TFrameWindow(0, "Sample ObjectWindows Program"));
    }
};

int
OwlMain(int /* argc */, char* /* argv */ [])
{
  return TDrawApp().Run();
}
This simple application includes a number of important features:

This basic application introduces two of the most important concepts in ObjectWindows programming. As simple as it seems, deriving a class from TApplication and overriding the InitMainWindow function gives you quite a bit of control over application execution. As you'll see in later steps, you can easily craft a large and complex application from this simple beginning.

Where to find more information

Here's a guide to where you can find more information on the topics introduced in this step:



[Contents] [Prev] [Next]