Bear
Bear

Reputation: 516

Opening a carbon c++ program from a custom url on OSx

I have been able to set the plist for my project to open the project with a given url. However, I can't get it to pass params to the application (custom urls are built based on the user)

Is there a way to pass the params as command line arguments?

the scheme is essentially url:userid

I need to be able to get the user id in the application. Is there a way to do this? I know with cocoa you can create an app delegate to handle this but I need a carbon way to do it.

Thanks in advance!

Upvotes: 0

Views: 295

Answers (1)

Kevin Grant
Kevin Grant

Reputation: 5431

Install an Apple Event handler to recognize URLs (both the suite and the event name have the same four-character code, 'GURL').

The event's direct object is a URL string. I would expect that string to contain the entire original URL, including any parameters that were encoded into it (e.g. if your custom scheme was xyz://some/data?param1=abc&param2=def, you should receive all of that).

Another important step is to register as a handler for that URL type in your Info.plist file. Read up on CFBundleURLTypes for more.

Upvotes: 1

Related Questions