1 // RegistrarTest1.cpp 2 3 #include <stdio.h> 4 5 #include <Application.h> 6 7 class TestApp : public BApplication { 8 public: 9 TestApp(const char* signature) 10 : 11 BApplication(signature) 12 { 13 } 14 15 ~TestApp() 16 { 17 } 18 19 virtual void ArgvReceived(int32 argc, char** argv) 20 { 21 printf("TestApp::ArgvReceived(%" B_PRId32 ")\n", argc); 22 BMessage *message = CurrentMessage(); 23 message->PrintToStream(); 24 BMessenger returnAddress(message->ReturnAddress()); 25 printf("team: %" B_PRId32 "\n", returnAddress.Team()); 26 for (int32 i = 0; i < argc; i++) 27 printf("arg %" B_PRId32 ": `%s'\n", i, argv[i]); 28 } 29 30 virtual void RefsReceived(BMessage* message) 31 { 32 printf("TestApp::RefsReceived()\n"); 33 message->PrintToStream(); 34 } 35 36 virtual void ReadyToRun() 37 { 38 printf("TestApp::ReadyToRun()\n"); 39 // PostMessage(B_QUIT_REQUESTED); 40 } 41 42 }; 43 44 // main 45 int 46 main() 47 { 48 TestApp* app = new TestApp("application/x-vnd.Haiku-TestApp1"); 49 app->Run(); 50 delete app; 51 52 return 0; 53 } 54 55