int Main(...)

To get to first base with Lgi you need to get the first window up and the application loop running. This is one of the things that is currently quite different under Win32 and BeOS, but considering it's such a small section of code it's not that much of a worry. Example:

#include "defs.h"
#include "memdev.h"
#include "file.h"
#include "gdc2.h"

#include "Application.h"
int main()
{
	Application *App = NEW(Application("application/x-Application", 0));
	if (App)
	{
		MemoryDevice Memory;
		FileDevice File;
		GdcDevice Gdc;

		NEW(AppWnd);
		App->OnCmdLine(0);
		App->Run();
		
		DeleteObj(App);
	}

	return 0;
}
int
WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	OleInitialize(NULL);
	CoInitialize(NULL);
	InitCommonControls();

	MemoryDevice Memory;
	FileDevice File;
	GdcDevice Gdc;

	Application App(hInstance, lpCmdLine, nCmdShow);
	NEW(AppWnd);
	App.OnCmdLine(lpCmdLine);
	App.Run();

	CoUninitialize();
	OleUninitialize();
	return 0;
}

What these sections of code do is initialize the various libraries, allocate an application object, open the main application window and then begin the applications message loop. The application object is inherited from the GApp object.

In the constructor of your application window I suggest setting GApp->AppWnd to point to your main application window. So that when the application shutdowns due to a system request it takes the window with it.


© 1999 Matthew Allen