1 // AppQuitTestApp3.cpp 2 3 #include <stdio.h> 4 5 #include <OS.h> 6 7 #include "CommonTestApp.h" 8 9 class Quitter : public EventHandler { 10 public: 11 virtual void HandleEvent(CommonTestApp *app) 12 { 13 app->Lock(); 14 app->Quit(); 15 app->Unlock(); 16 } 17 }; 18 19 int 20 main() 21 { 22 // R5: doesn't set the error variable in case of success 23 #ifdef TEST_R5 24 status_t error = B_OK; 25 #else 26 status_t error = B_ERROR; 27 #endif 28 CommonTestApp *app = new CommonTestApp( 29 "application/x-vnd.obos-app-quit-testapp1", &error); 30 init_connection(); 31 report("error: %lx\n", error); 32 report("InitCheck(): %lx\n", app->InitCheck()); 33 app->SetReportDestruction(true); 34 if (error == B_OK) { 35 app->RunEventThread(10000, 1, new Quitter); 36 app->Run(); 37 } 38 delete app; 39 return 0; 40 } 41 42