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 : BApplication(signature) 11 { 12 } 13 14 ~TestApp() 15 { 16 } 17 18 virtual void ArgvReceived(int32 argc, char **argv) 19 { 20 printf("TestApp::ArgvReceived(%ld)\n", argc); 21 BMessage *message = CurrentMessage(); 22 message->PrintToStream(); 23 BMessenger returnAddress(message->ReturnAddress()); 24 printf("team: %ld\n", returnAddress.Team()); 25 for (int32 i = 0; i < argc; i++) 26 printf("arg %ld: `%s'\n", i, argv[i]); 27 } 28 29 virtual void RefsReceived(BMessage *message) 30 { 31 printf("TestApp::RefsReceived()\n"); 32 message->PrintToStream(); 33 } 34 35 virtual void ReadyToRun() 36 { 37 printf("TestApp::ReadyToRun()\n"); 38 // PostMessage(B_QUIT_REQUESTED); 39 } 40 41 }; 42 43 // main 44 int 45 main() 46 { 47 TestApp *app = new TestApp("application/x-vnd.OBOS-TestApp1"); 48 app->Run(); 49 delete app; 50 return 0; 51 } 52 53