carbon

Setting the front most window using accessibility API

I want to set a certain window, from an external app (for example textedit), to be front most. I can successfully get a reference to the app itself using GetFrontProcess, and check whether it is front most. If it is not, I can use setFrontProcess to make it focussed. I can then use the the accessibility API to examine all the windows u...

Accessibility API - Setting keyboard focus to a specific element

Using the accessibility API, I am drilling down through a series of elements and finding a specific AXUIElementRef I am interested in (all in an external application). How do I check if this element currently has keyboard focus? And if not, how do I set it? Something similar to using AXUIElementSetAttributeValue to set the kAXMainAttr...

How to store (and use) the current mouse position?

What is the best way to store the current mouse position (system-wide) and then (later) put the mouse at that stored point? [NSEvent mouseLocation] gets me the position, and I can move the mouse with a CGEventMouseMoved, but they each use a different co-ordinates system (I believe y=0 is the top for NSEvent and the bottom for a CGEvent)...

Apple Carbon/CoreFoundation style guide?

Cocoa is well-documented and there is a lot of information on writing Cocoa code in good form. I'm working on some code that works closely with hardware, requiring me to use CoreFoundation and Carbon APIs often. Is there any sort of 'style' guide for understanding libraries such as Carbon and CoreFoundation from Apple? Apple's example...

Handling application exit in a Cocoa plug-in loaded into a Carbon application

I have a Cocoa plug-in that is loaded into an existing Carbon application. When the plug-in is first loaded, the Carbon application calls an initialization function, Plugin_Init() and in that function I set up the environment like so: //this is the global autorelease pool static NSAutoreleasePool* globalPool = nil; void Plugin_Init()...

OSX API Question: Where does BlockZero live?

I'm trying to compile a program I've been working with on OSX 10.6 It compiles fine under 10.5 but now I get an undeclared error for something called BlockZero. I'm not sure what this function is, what it does or where it lives. What do I have to import to fix this? Some Googling suggests it might be part of Carbon. Is there a particu...

how to capture mouse cursor in screen grab?

Hi, I'm using OpenGL to grab the contents of the Mac OSX screen - thsi works very well, except it does not grab the mouse cursor graphic. I need to somewhow get that cursor graphic, either as part of my screen capture routine, or separately. My question is either: How can I ensure that the mouse cursor image is included with the Open...

File sharing discovery in Cocoa

I'm trying to programmatically discover and then mount network volumes shared using OS X's file sharing from a Cocoa app. I'm using NSNetServiceBrowser to discover which servers are advertising file sharing - easy enough. My question is about the next step - how do you discover what shares are available for a given machine? ie. given th...

Look up a volume by UUID

I know the UUID of a volume - as found in Disk Utility. How can I get additional information on the volume? Most importantly, I want to know its mount point. Looking at /etc/fstab doesn't do the trick. This does not list the root volume. I would at least need to figure out the UUID of the root volume to verify my known UUID against it...

Carbon - OS X - Sending modified key events using CGEventPost

I'm trying to programmatically send modified keystrokes, for instance a capital "A". The problem is that the shift modifier does not seem to have any effect. In my code, I have two events, one for the shift key down, and another for the 'm' key down. CGEventRef mDown = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)46, true); CGEventRef ...

Generate the hardware interupt which will enable the CapsLock

Hello All, I want to Send my machine an hardware event so that my caps-lock key becomes enable. When I send enable interrupt, light on Caps-lock key should be on and when I send enable interrupt, light on Caps-lock key should be off. I am using Qt, Mac, C++, Carbon. Any help is appreciated. Thanks, Rahul ...

Recording KeyCommands in a round view like tweetie or things preferences

How would you record the keystrokes in view and set them to the NSUserdefaults because every key has a numeric value and there are also modifier keys…how would u do this Thanks ...

Get title of front window in carbon

Hello, I am writing a program to sit in the background on osx 10.6, listen to keystrokes and record them, grouping them by window title. (No, I am not writing malicious software. I do not need this program to be sneaky in any way, I just want to have a safety net for when I have typed a huge email and then accidentally refresh the page...

Simulating key press events in Mac OSX

Hi, 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, and what I have is a code that represents the specific key. So, for example, I reciev...

CGPostEvent not working on Spotlight search result list drop down

Hi All, I am using CGEventPost() to post mouse events on my Leopard and Snow Leopard. I am doing this from a remote application, just live VNC viewer. Every thing works fine except the case when I try to launch any application after searching it in Spotlight. Remotely when I try to Launch any application after searching it in spotlight,...

Suggestion for dragster/dropzone like dock menu

I'd like to create a dragster/dropzone like dock menu. Looks a bit like a stack with a nsview in it. After a lot if documentation searching and googling I've found a way to determine a dock icon's location. (http://cocoadev.com/forums/comments.php?DiscussionID=1431) Is nzbdrop creating a view which just looks like an stack to display...

Cocoa equivalent of the Carbon method getPtrSize

I need to translate the a carbon method into cocoa into and I am having trouble finding any documentation about what the carbon method getPtrSize really does. From the code I am translating it seems that it returns the byte representation of an image but that doesn't really match up with the name. Could someone give me a good explanati...

Read list of applications from the Applications folder on Mac using Qt

Hello All, I want to read list of applications from the Applications folder on Mac using Qt or Carbon. I am not sure how to do this. So any pointers will be appreciated. Thanks Rahul ...

Different cursor formats in IOFrameBufferShared

I'm reading the moust cursor pixmap data from the StdFBShmem_t structure, as defined in the IOFrameBufferShared API. Everything works fine, 90% of the time. However, I have noticed that some applications on the Mac set a cursor in a different format. According to the documentation for the data structures, the cursor pixmap format should...

Application menu is enabled even if a modal dialog box is open.

I have an application where I can launch a modal dialog box over a main window. The main window has some network activity going on in background which updates my background UI. Due to this the application menu becomes accessible even if the modal dialog is open. How can I avoid this? Any help is appreciated. I am using Mac, Qt, Carbon....