Questions tagged [macos-carbon]

Carbon is Apple's previous application-development framework for Mac OS X for applications that needed to remain compatible with the Classic Mac OS.

Carbon is Apple's previous application-development framework for Mac OS X (), which existed primarily for applications that needed to remain compatible with the Classic Mac OS. Most of the original Carbon APIs existed both on Mac OS X and in a dynamic library (CarbonLib) for Mac OS 9.

Much of it is now deprecated and unavailable to 64-bit applications as of Mac OS X 10.6, but not all. Core Services (including the File Manager and even the Resource Manager) and much of Application Services (including ) are 64-bit-compatible, as are a few Carbon APIs, such as some parts of the Carbon Event Manager. Be sure of your ground before you tell a questioner they need to switch to Cocoa (); the API they're using may be perfectly safe, and may even be the only API specifically designed for their task (as part of Carbon Event Manager is for hotkeys).

Note that just because an API is in the Legacy Mac OS X Reference Library doesn't mean everything in it is deprecated or doomed. Again, Carbon Event Manager is an example.

547 questions
14
votes
4 answers

OS X equivalent to OutputDebugString()?

I'm examining the feasibility of porting an existing Windows MFC control to OS X/Carbon. My test bed is a C++ Carbon application generated using the XCode 3 Wizard. I'm looking for a quick way to dump some trace info to the debugger or the OS X…
J Evans
  • 1,090
  • 2
  • 16
  • 36
14
votes
1 answer

Set non-owned window always on top - Like the app "Afloat"

I have set up a global hotkey with RegisterEventHotkey. When the user presses it, it gets the currently focused window with CGWindowListCopyWindowInfo, and then I need to set it always on top. If the current window is in my process (from which I am…
Noitidart
  • 35,443
  • 37
  • 154
  • 323
14
votes
2 answers

Simulating key press events in Mac OS X

I'm writing an app where I need to simulate key press events on a Mac, given a code that represents each key. It seems I need to use the CGEventCreateKeyboardEvent function to create the event. The problem is that this function needs a Mac keycode,…
Thomi
  • 11,647
  • 13
  • 72
  • 110
14
votes
1 answer

Debugging a NULL CGContext under Cocoa/Carbon

During the execution of my program I'm getting the following output in the XCode debugging console: : CGContextSetTextMatrix: invalid context 0x0 I have no idea where in the application this NULL-context is being passed to the OS. Anyone…
fbrereto
  • 35,429
  • 19
  • 126
  • 178
14
votes
8 answers

How can I determine the running Mac OS X version programmatically?

I have a program which needs to behave slightly differently on Tiger than on Leopard. Does anybody know of a system call which will allow me to accurately determine which version of Mac OS X I am running. I have found a number of macro definitions…
Joe Corkery
  • 2,564
  • 3
  • 18
  • 26
13
votes
1 answer

Global modifier key press detection in Swift

I'm trying to use Carbon's function RegisterEventHotKey to create a hotkey for when the command key is pressed. I'm using it like so: InstallEventHandler(GetApplicationEventTarget(), handler, 1, &eventType, nil,…
user3225395
  • 581
  • 6
  • 23
12
votes
4 answers

Editing resource forks on the command line on Mac OS X

Mac OS X stores some files with resource forks. I need to create a file with a resource fork. The trouble is, I need to create this file on the command line. Is anyone aware of how you can create a file with a resource fork on the command line in…
Jesse Michaels
12
votes
6 answers

Programmatically check if a process is running on Mac

Is there any Carbon/Cocoa/C API available on Macs that I can use to enumerate processes? I'm looking for something like EnumProcesses on Windows. My goal is to check from code whether a process is running (by name). Thanks!
psychotik
  • 38,153
  • 34
  • 100
  • 135
12
votes
6 answers

Controlling OSX windows

I'm trying to control windows of a foreign OSX applications from my application. I'd like to 1. move the windows on the screen 2. resize the windows on the screen 3. change the currently active window of the application 4. get the currently active…
Sami
  • 3,263
  • 3
  • 29
  • 37
11
votes
2 answers

How to monitor global modifier key state (in any application)?

I'm using some Carbon code in my Cocoa project for handling global key events (shortcuts) from other applications. Currently I have setup a kEventHotKeyReleased event handler and I can successfully obtain hot keys when my application is not active.…
Form
  • 1,949
  • 3
  • 25
  • 40
11
votes
4 answers

Globally hide mouse cursor in Cocoa/Carbon?

Is there a way to globally hide the mouse cursor for all apps in Cocoa (or Carbon)? Or at least replace it with something else? EDIT: Thanks for the input guys, but turns out Daniel Jalkut found the solution a while ago :)…
Saurabh Sharan
10
votes
3 answers

Is there a way to check if process is 64 bit or 32 bit?

I am trying to find process type (32 bit/ 64bit) from process pid? I get the process information and process list from using GetBSDProcessList method described here. how can we get the process type information? Any Ideas? I can use defined(i386) or…
RLT
  • 4,219
  • 4
  • 37
  • 91
10
votes
8 answers

Compiling Bochs on Mac os x Snow Leopard

Was someone able to compile the Bochs simulator under Snow Leopard. Leopard worked fine for me but under Snow Leopard I get alot of problems related to the Carbon library... Ok, some more information was request. I compile with make on the shell;…
Mac4711
10
votes
3 answers

Global Mouse Moved Events in Cocoa

Is there a way to register for global mouse moved events in Cocoa? I was able to register for the events using Carbon's InstallEventHandler(), but would prefer a Cocoa equivalent. I have looked for NSNotificationCenter events, but there doesn't seem…
Colin Gislason
  • 5,449
  • 2
  • 27
  • 22
10
votes
1 answer

Cocoa switch focus to application and then switch it back

I want to create OS X application which shows up and getting focused with system-wide hotkey, and then, with same hotkey it should dissapear and switch focus back. Just like Alfred does it. The problem is that I can't focus back on application…
sashab
  • 1,534
  • 2
  • 19
  • 36
1
2
3
36 37