carbon

Obtaining a proc pointer to a Carbon API at runtime

I have a Mac application that I must build against the Mac OS 10.4 SDK for various reasons beyond my control. Given that my application's minimum OS version will be 10.5. (I know, I know... but I can't give any more details than the above to justify why this is the case.) Within the Mac OS 10.5 SDK is an API, FSMatchAliasBulk, for which...

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 window. (And I'd like to do this either through ObjC/C/C++ apis). What are the API calls ...

CGWindowID from AXUIElement

I'm trying to automate a foreign OSX application using the accessibility API. Some of the state of the application isn't available through the API, so I acquire it through screen scraping. To do this, I need to get CGWindowID for an accessibility object with a 'Window Role'. Is there any direct way of acquiring CGWindowID of a 'Window R...

Preventing an application from being moved between spaces

Working on an application that contains legacy Carbon code (mixed with some Cocoa). It is a full screen app (not technically, it just draws itself as though it were) that hides the dock and application menu bar when active. What I'd like to do is prevent the application from being allowed to move between Spaces. Basically, if the user a...

Linking against Apple frameworks with gcc

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 ...

Can Cocoa be used in FileMaker Plugins?

I am trying to port a Windows FileMaker plugin to OS X and am thinking that I should be doing this in Cocoa not Carbon, but I am struggling to get anything to compile as soon as I include Cocoa.h ...

Get mach_absolute_time/UpTime() in nanoseconds in Python

I need to access the elapsed time since startup in nanoseconds from a Python program running on Mac OS X 10.6. I use the following Carbon calls to get this in C code: AbsoluteTime uptimeAbs = AbsoluteToNanoseconds(UpTime()); uint64_t elapsedTime = ((uint64_t)uptimeAbs.hi << 32) + uptimeAbs.lo; Is it possible to get to these functions...

How do I get an Mac OS Component Manager Component to be visible to other processes?

This is a bit esoteric, but there have to be a few people here who know how OS X's Carbon Component Manager works. I've made a couple of little apps to play around with making Components (see here for some background). Actually, one of the apps is a sample program straight from Apple called 'Fiendishthngs'. It lists all the Components th...

How to read the content of an other app's text field on OS X?

For a project I must create a little buddy app that will read the content of one of the main app's text fields. Is there a way to get to the contents of a window/control (I'm interested in the text of the text field) on OS X? Something like GetDlgItemText() on Windows where I just pass the control's global handle and will get the contr...

Debugging a NULL CGContext under Cocoa/Carbon

During the execution of my program I'm getting the following output in the XCode debugging console: <Error>: CGContextSetTextMatrix: invalid context 0x0 I have no idea where in the application this NULL-context is being passed to the OS. Anyone know of a good technique to hunt it down? Can I break into the application when something i...

difference between carbon and cocoa ?

What is the difference between carbon and cocoa ? For what type of applications we should use carbon and for what type of applications we should use cocoa ? Which is the best of both for developing applications in Mac OS ? ...

Using CFBooleanRef through JNA

I'm using JNA to call Carbon APIs. The particular API call that I want to call takes a CFBooleanRef as a parameter. The values, kCFBooleanTrue and kCFBooleanFalse, are declared as direct extern references in the header files. How can I get references to those two values on the Java side, so that I can pass the values to the API call ? ...

Can anyone tell me about the Event Handler or Callback on switching of the front process on Mac?

I need to have the callback or some event handler which can help me, know front process is changed. Mac: C++/Carbon. Any help is highly appreciated. Thanks, Rahul ...

fetch the path of the application

Hello All, I am using following code to fetch the path of the application. It works for all cases but fails for front row. CFStringRef cfStrAppShortName = NULL; FSRef appRef; CFURLRef cfAppUrlRef = NULL; CFBundleRef cfAppBundleRef = NULL; CFDictionaryRef cfAppDictRef = NULL; CFStringRef cfStrAppBundleName = NULL; OSErr osErr; c...

Event handler when user manually shutsdown system.

Hello All, I need a event handler when ever shutdown message is send to system. Can anyone help? When ever we try to shutdown a system, and if any dialog box is open shutdown process terminates. I don't want this to happen in my application. i.e if any dialog box is open from my application and I try to shutdown my system then it shoul...

Crash in Aquatic Prime Carbon

I just released an app (32 bit/10.5 SDK) relying on the Carbon implementation of Aquatic Prime to deal with licensing. Now I've started getting crash logs pointing to a problem in APCreateDictionaryForLicenseData. The crash occurs on this line: if (!rsaKey->n || !rsaKey->e) return NULL; [rsaKey is a static RSA created with RSA_new(...

MPQueue - what is it and how do I use it?

I encountered a bug that has me beat. Fortunately, I found a work around here (not necessary reading to answer this q) - http://lists.apple.com/archives/quartz-dev/2009/Oct/msg00088.html The problem is, I don't understand all of it. I am ok with the event taps etc, but I am supposed to 'set up a thread-safe queue) using MPQueue, add ...

Guides, Tutorials or Books about building MacOSX GUI apps with C++ in Xcode?

Hi, with GUI apps I mean not just a Unix command line application, but the whole .app bundle and a full Cocoa or Carbon application. Thanks! PS: I wasn't totally accurate with GUI application. I meant an application with a window and a menu, as opposed to a Unix command line application. Actually I got to a tutorial about programming wi...

Suppressing the default event handler when using GetEventMonitorTarget()

I have an application that borrows code from the Apple event handling sample. It looks like: InstallEventHandler(GetEventMonitorTarget(), MonitorHandler, GetEventTypeCount(kEvents), kEvents, 0, &sHandler ); GetEventMonitorTarget() is all about getting events for other applications. But from what I've read the event is sort of forked...

Call cocoa app from context menu item click

Hi I am creating a CMI plugin in Carbon to add a menu item to my Finder's context menu. I would like call some web services when the item is clicked. Now since the context menu selection handler is written in C, I am not very sure if I would like to do it there. Is it possible to call a Cocoa application on the context menu item's cli...