Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6149361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:26:22+00:00 2026-05-23T19:26:22+00:00

I am looking for Cocoa/Carbon API to enable me to switch between different application?

  • 0

I am looking for Cocoa/Carbon API to enable me to switch between different application?

Something like when Command + Tab is pressed.

I dont need NSWorkspace launch application. I know this will bring application in focus and I can switch between application. I want to do something which system does.

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:26:23+00:00Added an answer on May 23, 2026 at 7:26 pm

    Try these methods in NSWorkspace:

    /* The following methods return information about an application as a dictionary containing as many of the following keys as are available:
            NSApplicationPath (the full path to the application, as a string)
            NSApplicationName (the application's name, as a string)
            NSApplicationBundleIdentifier (the application's bundle identifier, as a string)
            NSApplicationProcessIdentifier (the application's process id, as an NSNumber)
            NSApplicationProcessSerialNumberHigh (the high long of the PSN, as an NSNumber)
            NSApplicationProcessSerialNumberLow (the low long of the PSN, as an NSNumber)
       The same information will now be provided in the userInfo of the NSWorkspace notifications for application launch and termination.
    */
    
    /* Gets an array of NSDictionaries with the above keys.  In addition, the NSWorkspaceApplicationKey is provided, and vends an instance of NSRunningApplication.  This method does not return applications that are UIElement or BackgroundOnly.  To access the entire list of running applications, use the -[NSWorkspace runningApplications] method, declared in NSRunningApplication.h. */
    - (NSArray *)launchedApplications;
    
    /* Launches an application.  The appName may be a full path to the app, or the name alone, with or without the .app extension. */
    - (BOOL)launchApplication:(NSString *)appName;
    
    /* Launches the app at the given URL.  If the app is successfully launched, a reference to the new running app is returned.  If the app is already running, and NSWorkspaceLaunchNewInstance is not specified, then a reference to the existing app is returned.  If the app could not be launched, nil is returned and an NSError is returned by reference.
    
      The configuration dictionary can be used to pass additional options to the app.  Possible keys are listed later in this file (search for NSWorkspaceLaunchConfiguration). The configuration dictionary may be nil, in which case default behavior applies.
    */
    - (NSRunningApplication *)launchApplicationAtURL:(NSURL *)url options:(NSWorkspaceLaunchOptions)options configuration:(NSDictionary *)configuration error:(NSError **)error AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER;
    

    Just pass the name or url (created from the path) which is obtained from the first method, to the second or third respectively.

    NSArray *apps = [[NSWorkspace sharedWorkspace] launchedApplications];
    [[NSWorkspace sharedWorkspace] launchApplication:[[apps objectAtIndex:0] objectForKey:NSApplicationName]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any Carbon/Cocoa/C API available on Macs that I can use to enumerate
Looking to do a very small, quick 'n dirty side project. I like the
Looking for a Linux application (or Firefox extension) that will allow me to scrape
I'm looking for application-wide access to raw keyboard events in OS X, either using
with GUI apps I mean not just a Unix command line application, but the
I'm looking for strategies and articles on making Carbon code 64-bit ready. Carbon for
This is part of an iPhone application but should apply to Cocoa written in
Looking for feedback on : http://code.google.com/p/google-perftools/wiki/GooglePerformanceTools
Looking for an example that: Launches an EXE Waits for the EXE to finish.
Looking for C# class which wraps calls to do the following: read and write

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.