Been a while since I had to do this but the basic steps are.
1. Get the system status bar
2. Tell the status bar to give you a status item
3. Create a new menu and assign it to the status item
so something like the following would probably work.
Code:
NSStatusBar *systemStatusBar = [NSStatusBar systemStatusBar];
NSStatusItem *test = [systemStatusBar statusItemWithLength: NSVariableStatusItemLength];
[test setTitle: @"Hello"];
NSMenu *testMenu = [[NSMenu alloc] init];
[testMenu setAutoenablesItems: YES];
[testMenu addItem: [[NSMenuItem alloc] initWithTitle: @"1" action: @selector(menuItemPressed:) keyEquivalent:@""]];
[testMenu addItem: [[NSMenuItem alloc] initWithTitle: @"2" action: @selector(menuItemPressed:) keyEquivalent:@""]];
[test setMenu: testMenu];
to make your application run in the background just assign the "Application is background only" property in your application info.plist
To get the application to run at start up have the user add a "Login Item" for you application. I'm sure there is a way to do this programmatically but I have not done so.
To do this manually go to System Preferences -> Users and Groups
Select the user you want and click the "Login Items" tab.