启动程序,使其在启动应用程序的中心打开
启动程序,使其在启动应用程序的中心打开。
平台:Mac 启动机制:使用 system() 启动 C++ 程序
目前我观察到启动的程序将其推到屏幕的大部分左侧。
Launching a program so that it opens in center of the launching application.
Platform: Mac
Launching mechanism: a c++ program launches using system()
Currently I observe the program launched pushes it to left most part of the screen.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Mac OS X 系统上,程序不会启动到屏幕的特定区域。当它们启动时,它们成为“前端”应用程序,并用自己的菜单接管菜单栏区域。他们可能会在打开窗户后选择打开或不打开。
查明相关程序是否接受 Apple 事件/applescript 命令。如果是这样,您可以要求程序将窗口放置在特定位置。
另外,如果您仍然需要使用
system
,您可以使用osascript
命令发送 Apple 事件。On Mac OS X systems, programs don't launch into a specific area of the screen. When they launch, they become the "front" application, and take over the menubar area with their own menus. They may choose to open a window after they have opened, or not.
Find out if the program in question accepts apple events / applescript commands. If so, you may be able to ask the program to position a window in a particular location.
Also, if you still have to use
system
, you can send apple events with theosascript
command.如果您使用的是
system
,那么您实际上无能为力,因为您已经隐式地将除启动参数之外的进程的所有内容委托给了操作系统。可能有多种方法可以使用其他特定于 OSX 的 API 来完成此操作,但不能使用您在此处列出的参数。If you're using
system
, there's really nothing you can do, since you've implicitly delegated everything about the process except its startup args to the OS. There may be ways to accomplish this using other OSX-specific APIs, but not with the parameters you've outlined here.