PDA

View Full Version : Call an application from Context Menu plugin.




imranpundeer
Feb 16, 2009, 11:11 PM
Hi All,
I am new in MAC programming. I made a plgin for Context Menu Handler.
I added an element in Context Menu and want to launch an application after click the menu item with command lin argument. Please help me out how can i launch the application through click of that menu handler.

Any helpp would be appricated.

Regards,
Imran.



kainjow
Feb 18, 2009, 06:10 AM
You can use Launch Services to open an application. Here's a sample:
CFStringRef path = CFSTR("/Applications/TextEdit.app");
CFURLRef appURL = CFURLCreateWithFileSystemPath(NULL, path, kCFURLPOSIXPathStyle, false);
LSOpenCFURLRef(appURL, NULL);
CFRelease(appURL);