
class TMyApplication: public TApplication
{
public:
TMyApplication(const char far* name = 0) : TApplication(name) {}
};
int
OwlMain(int argc, char* argv[])
{
char title[30];
if(argc >= 2)
strcpy(title, argv[1]);
else
strcpy(title, "Wow!");
return TMyApplication(title).Run();
}
If you do decide to provide your own WinMain, T pplication supportsA
passing traditional WinMain function parameters with another constructor.
The following example shows how to use that constructor to pass WinMain
parameters to the T pplication object:A
#include <owl\applicat.h>
class TMyApplication : public TApplication
{
public:
TMyApplication (const char far* name,
HINSTANCE instance,
HINSTANCE prevInstance,
const char far* cmdLine,
int cmdShow)
: TApplication (name, instance, prevInstance, cmdLine, cmdShow);.
.
.
};
int
PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
{
return TMyApplication("MyApp", hInstance, hPrevInstance,
lpszCmdLine, nCmdShow).Run();
}
Users can run multiple copies of an application simultaneously From the.
Initializing the
point of view of a 16-bit application, first-instance initialization happens
application
only when another copy of the application is not currently running. Each-
instance initialization happens every time the user runs the application. If a
user starts and closes your application, starts it again, and so on, each
1
6
instance is a first instance because the instances don’t run at the same time.
Chapter 3, Application objects
123