![]() |
#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.