Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
通常在 Obj C 中,NSApplicationDelegate 会处理这个问题。但是我将如何在 C 中做到这一点?我猜我在问什么,在 OS/X 出现之前 Mac 程序是如何做到这一点的?谢谢。
在 Mac OS 9 中,应用程序在启动时(或稍后)通过注册并'odoc'在启动时接收 Apple 事件来打开文档。这在 C 中很重要,我强烈建议您不要尝试它。特别要注意,除非您的应用程序具有 Carbon 事件循环,否则这不太可能正常工作。
'odoc'
在此之前,还有一种机制,即应用程序在启动时打开的文件在堆栈顶部的内存块中指定。这种机制在 OS X 上不再存在,所以在今天已经无关紧要了。