Mac中启动另一个程序并将窗口置于最前面
2015-11-09 10:51
706 查看
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | - (void)launchSoftWithBundleID:(NSString *)softPath { NSBundle *softBundle = [NSBundle bundleWithPath:softPath]; NSString *bundleID = [softBundle bundleIdentifier]; //运行程序 NSTask *softTask = [[NSTask alloc] init]; [softTask setLaunchPath:softPath]; [softTask launch]; //得到运行的程序,并置于最前面 NSArray *array = [NSRunningApplication runningApplicationsWithBundleIdentifier:bundleID]; if ([array count] > 0) { NSRunningApplication *runningApp = [array objectAtIndex:0]; [runningApp activateWithOptions:NSApplicationActivateIgnoringOtherApps]; } } |
相关文章推荐
- Linux_OpenSSH远程连接
- jquery-easyui combobox combogrid 级联不可编辑实例
- .Net多线程 并行编程(三)---并行集合
- BCH码
- Android ViewHolder的作用与用法
- MongoDB PHP
- android 内存泄漏 与分析
- Javascript模块化编程(二):AMD规范
- JAVA字符串格式化-String.format()的使用(转)
- Rogue游戏(四)——药品、楼梯、升级
- 拓扑排序的原理及其实现
- SQL 脚本语言知识点回顾 一
- 使用Qt开发文本编辑器(一):功能介绍
- http://blog.csdn.net/altair86/article/details/8972178
- 加载自定义xib UIView的方法和加载纯代码 UIView代码的区别
- dijkstra 解决单元最短路(无负权)
- 解决Cocos客户端libpng warning:iCCp:known incorrect sRGB profile
- poj1161 walls floyd算法+把面当结点建图
- I2C接口
- linux 下eclipse 及c/c++开发环境的搭建: