什么是UpdateSystemActivity的Cocoa等价物? [英] What is the Cocoa equivalent of UpdateSystemActivity?

查看:211
本文介绍了什么是UpdateSystemActivity的Cocoa等价物?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Carbon应用程式转换为Cocoa应用程式,但找不到Cocoa等效项:

I'm converting a Carbon app to a Cocoa app and I can't find the Cocoa equivalent for:

UpdateSystemActivity(UsrActivity);

任何Mac人都在指望我朝正确的方向?感谢。

Any Mac people out there care to point me in the right direction? Thanks.

UPDATE :我正在建设64位。建立32bit工作正常,但我得到的符号未声明在此范围错误UpdateSystemActivity(和其他人)时,我建立64位。

UPDATE: I'm building 64bit. Building 32bit works fine, but I get symbol not declared in this scope errors for UpdateSystemActivity (and others) when I build for 64bit.

UPDATE2 :我要导入以下内容:

UPDATE2: I'm importing the following:

#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
#import <OpenGL/CGLMacro.h>

在构建64位时需要导入其他东西吗?

Is there some other thing I need to import when building 64bit?

UPDATE3 :添加 #import< CoreServices / CoreServices.h> 没有帮助。我仍然得到编译器错误,告诉我UpdateSystemActivity和UsrActivity没有在这个范围内声明。

UPDATE3: Adding #import <CoreServices/CoreServices.h> did not help. I still get compiler errors telling me UpdateSystemActivity and UsrActivity was not declared in this scope.

UPDATE4 :好的,文件在OSServices / 。H。我正在构建针对10.5 SDK,并快速搜索显示:

UPDATE4: Okay, file not found on OSServices/Power.h. I'm building against the 10.5 SDK and a quick search shows:

$ pwd
/Developer/SDKs
$ find . -name Power.h
./MacOSX10.3.9.sdk/Developer/Headers/CFMCarbon/OSServices/Power.h
./MacOSX10.3.9.sdk/Developer/Headers/CFMCarbon/Power.h
./MacOSX10.3.9.sdk/Developer/Headers/FlatCarbon/Power.h
./MacOSX10.3.9.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/Headers/Power.h

./MacOSX10.4u.sdk/Developer/Headers/CFMCarbon/OSServices/Power.h
./MacOSX10.4u.sdk/Developer/Headers/CFMCarbon/Power.h
./MacOSX10.4u.sdk/Developer/Headers/FlatCarbon/Power.h
./MacOSX10.4u.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/Headers/Power.h

./MacOSX10.5.sdk/Developer/Headers/FlatCarbon/Power.h
./MacOSX10.5.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/Headers/Power.h

但我得到:

Mac.mm:6:29: error: OSServices/Power.h: No such file or directory
Mac.mm:6:29: error: OSServices/Power.h: No such file or directory


推荐答案

您仍然可以调用 UpdateSystemActivity

API的文档指定导入 CoreServices / CoreServices.h 获取API - 但是通过标题(特别是在 OSServices / OSServices.h 中)搜索显示在64位环境中省略了该文件。然而,有一些 Power.h (其中 UpdateSystemActivity 被定义)被关闭64位, code> UpdateSystemActivity 不是其中之一。

The documentation for the API specifies importing CoreServices/CoreServices.h to get the API -- however hunting through the headers (notably in OSServices/OSServices.h) shows that the file is omitted in a 64bit environment. Nevertheless, there are sections of Power.h (where UpdateSystemActivity is defined) that are turned off for 64bits, and UpdateSystemActivity is not one of them.

鉴于此,请尝试 #import< ; OSServices / Power.h> ,看看是否能正常工作。 (您必须在项目中包含CoreServices框架,以便找到标题。)

In light of that, try to #import <OSServices/Power.h> directly and see if that works. (You'll have to include the CoreServices framework in your project for the header to be found as well.)

这篇关于什么是UpdateSystemActivity的Cocoa等价物?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆