macos-carbon

migrating an application from carbon to cocoa

↘锁芯ラ 提交于 2019-12-02 21:27:17
I am working on an application in which I need to migrate the whole code of it from carbon to cocoa.I have experience in programming of C,C++,python and Java during my college time and internship but have never touched objective C or have done any programming for Mac(Carbon and Cocoa) before this. So Can you please suggest me some sources to start with, also how should I go about the whole migration ? After researching on net I have found that most the people have suggested following books Cocoa Programming for Mac® OS X, Third Edition by Aaron Hillegass Programming in Objective C - Stephen

Get Mac unique identifier number (ex.: serial number) in 64-bits

主宰稳场 提交于 2019-12-02 20:17:25
问题 how can i retrieve in Cocoa, Mac unique identifier, for ex.: serial number in 64-bit mode ? I've followed couple articles but they were intended for 32-bit mode. Thanks 回答1: Have a look at this article "How to get hardware and network info" If you are having trouble with the 64bit architecture - or your app simply has to be a 64bit app - consider moving the IO part to a helper utility and access it using distributed objects. Have a look at Creating XPC Services 回答2: Simple way is to execute:

Linking against Apple frameworks with gcc

家住魔仙堡 提交于 2019-12-02 16:43:36
I've created some wrapper functions that encapsulate working with CoreAudio, and the goal is to create a C library that I can use with some command line C++ tools. So far things are working well. I took a sample project, modified it, and it builds and runs in XCode. I'd like to skip XCode altogether and build the library with gcc and a Makefile. How can I link against an Apple Framework? Are Frameworks just shared libraries that I could include in the -l and -L options on gcc? Here's an example: gcc -framework CoreServices -o test test.c From the man page of Apple's gcc (i686-apple-darwin10

List of all users and groups

此生再无相见时 提交于 2019-12-02 13:52:40
I'm trying to get a list of all users and all groups on Mac OS X 10.5+. How can I do this? For example, the list of all users on my machine should return: _amavisd, _appowner, _appserver, _ard, _atsserver, _calendar, _carddav, _clamav, _coreaudiod, _cvmsroot, _cvs, _cyrus, _devdocs, _dovecot, _eppc, _installer, _jabber, _lda, _locationd, _lp, _mailman, _mcxalr, _mdnsresponder, _mysql, _pcastagent, _pcastserver, _postfix, _qtss, _sandbox, _screensaver, _securityagent, _serialnumberd, _softwareupdate, _spotlight, _sshd, _svn, _teamsserver, _timezone, _tokend, _trustevaluationagent, _unknown,

Get Mac unique identifier number (ex.: serial number) in 64-bits

会有一股神秘感。 提交于 2019-12-02 13:18:21
how can i retrieve in Cocoa, Mac unique identifier, for ex.: serial number in 64-bit mode ? I've followed couple articles but they were intended for 32-bit mode. Thanks Have a look at this article "How to get hardware and network info" If you are having trouble with the 64bit architecture - or your app simply has to be a 64bit app - consider moving the IO part to a helper utility and access it using distributed objects. Have a look at Creating XPC Services Simple way is to execute: ioreg -l | grep IOPlatformSerialNumber | awk '{print $4}' 来源: https://stackoverflow.com/questions/9429205/get-mac

How to get other application to paste from my global hotkey

三世轮回 提交于 2019-12-02 09:57:24
I have written a small productivity tool that does a few string manipulations via the clipboard. It is currently registering a hot key, where it pulls in the clipboard text, processes it, and dumps the result back on the clipboard. I have this installed on CMD+SHIFT+V currently what you need to do from another apppiclation is copy (CMD+C) and then activate my hothandler (CMD+SHIFT+V), and then you have to paste it back into the orginal app with (CMD+V). I'd like to eliminate the third step if possible, so my hothandler somehow tells whatever is the active application to paste. Any suggestions

Using AppleScript with Apple Events in macOS - Script not working

余生颓废 提交于 2019-12-02 08:11:06
问题 We need to use a AppleScript to create an outgoing email message in macOS. The script works fine in the Script Editor. Using the code recommended by DTS https://forums.developer.apple.com/message/301006#301006 no results, warnings or errors. Same result with sample script from the forum. Need Swift and Apple Events expertise here. Thanks! import Foundation import Carbon class EmailDoc: NSObject { var script: NSAppleScript = { let script = NSAppleScript(source: """ set theSubject to "Some

How to convert a Carbon AXUIElementRef to Cocoa NSWindow

跟風遠走 提交于 2019-12-02 07:51:31
In my project, i can get the window which mouse is on, and i can use AXUIElementSetAttributeValue(element, kAXFrontmostAttribute, kCFBooleanTrue); to make the window to top level temporarily. So i want to convert the element to Cocoa NSWindow and then use makeKeyAndOrderFront to make it always in front. Anyone know how to implement this. + (NSArray *)attributeNamesOfUIElement:(AXUIElementRef)element { NSArray *attrNames = nil; AXUIElementCopyAttributeNames(element, (const void*)&attrNames); AXUIElementSetAttributeValue(element, kAXFrontmostAttribute, kCFBooleanTrue); // Below lines doesn't

Replacing CMNewProfileSearch with non-deprecated, 64-bit code

…衆ロ難τιáo~ 提交于 2019-12-02 05:12:34
I have existing code that uses CMNewProfileSearch to find then iterate over the color profiles on the system getting their names and full paths. Unfortunately, CMNewProfileSearch is deprecated in Mac OS X 10.5 and is also unavailable when compiling a 64-bit application. In reading the ColorSync Manager 2.5 Reference, it seems like the new way to iterate over installed color profiles is to use the CMIterateColorSyncFolder function. Is that true? Is there a Cocoa way to do what I want instead? Anybody got any sample code? Thanks. Yes. As you indicated, the ColorSync Manager Reference says the

Get a bounds of WindowRef?

ぃ、小莉子 提交于 2019-12-01 18:19:00
I am trying to find a Carbon API which can give me the WindowRef from window id and with that windowref I want to have bounds? EDIT: I found API extern WindowRef HIWindowFromCGWindowID(CGWindowID inWindowID); But I am not able to use it. I have included carbon header and have also added its framework to project. Is there something else required to HI apis? Any help is appreciated. Thank you for your time. Following should do - CGRect rect; uint32_t windowid[1] = {windowID}; CFArrayRef windowArray = CFArrayCreate ( NULL, (const void **)windowid, 1 ,NULL); CFArrayRef windowsdescription =